Php Basics

Source: Internet
Author: User
Tags ini php class php basics php tutorial reserved

Basic knowledge

<? Php Tutorial
Echo "1, display_errors = On is displayed in php. ini. <br> ";
Echo "2, used to print echo and print <br> ";
Echo "the reason why wamp cannot be used after installation is that iis has been installed is that apache cannot start the listener and stop iis ";
Phpinfo (); // use a semicolon (;) to end each line of statements

/*
Display_errors = On is displayed in php. ini.
Use echo and print
*/

/*
Multi-line comment
*/

// Single line comment
# Single line comment
?>

Knowledge about simple variables and simple arrays
1. Hybrid encoding of htm and php
2. A statement ends with a semicolon)
3. How to define a variable and how to use the variable

Php Data operation type
Four scalar variables
Boolean
Integer
Float, double
String
Two composite types
Array
Object

<? Php
Echo "<br> ";
Echo "how to define a variable and use the variable <br> ";

$ A = 9;
Echo "$ ";
Echo "<br> ";
$ B1 = true; $ b2 = FALSE;
$ F = 1.26;
$ S = "string type ";
Echo "int". $ a. "boolean". $ b1. "float". $ f. "string". $ s;

$ Arr = array (1, 2, 3, 4, 5 );
$ Arr2 = array ("id" => 100, "title" => "this is new ");
$ Arr3 = array (1, 2, 3, 4), array (5, 6 ));
Echo "<br> ";
Echo $ arr;
Print_r ($ arr2 );
Echo "<br> ";
Echo $ arr3 [0] [3]. $ arr3 [1] [1];
Echo $ arr2 ['id'];

?>


The stdClass class is an internal reserved class of PHP. It has no member variables or member methods at the beginning, and all magic methods are set to NULL. You can use it to pass variable parameters, however, there are no methods that can be called. The stdClass class can be inherited, but it makes no sense to do so.

This class is a reserved PHP class, not the base class of all classes.

View sourceprint? 1 <? Php

2 class foo {}

3 $ bar = new foo ();

4 echo $ bar instanceof stdClass? 'Yes': 'no ';

5 // output: no

Another example:

View sourceprint? 01 <? Php

02 // CTest does not derive from stdClass

03 class CTest {

04 public $ property1;

05}

06 $ t = new CTest;

07 var_dump ($ t instanceof stdClass); // false

08 var_dump (is_subclass_of ($ t, 'stdclass'); // false

09 echo get_class ($ t). "n"; // 'ctest'

10 echo get_parent_class ($ t). "n"; // false (no parent)

11?>

Any forced conversion with (object) will get an instance of stdClass.

Refer:

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.