Analyze the specific meaning of the PHPobject object. Everyone knows that PHPobject object initialization: to initialize an object, use the new statement to instance the object to a variable .? Phpclassfoo {functiondo_foo () {echoDoingfoo. ;}}$ bar everyone knowsPHP object initialization: to initialize an object, use the new statement to instance the object to a variable.
- <? Php
- Class foo
- {
- Function do_foo ()
- {
- Echo "Doing foo .";
- }
- }
-
- $ Bar = new foo;
- $ Bar-> do_foo ();
- ?>
Convert to PHP object: If you convert an object to an object, it will not change. If any other type of value is converted to an object, an instance of the built-in class stdClass will be created. If the value is NULL, the new instance is NULL. For any other value, the member variable named scalar will include this value.
- < ?php
- $obj = (object) 'ciao';
- echo $obj->scalar; // outputs 'ciao'
- ?>
Initialize PHP object: to initialize an object, use the new statement to instance the object to a variable. ? Php classfoo {functiondo_foo () {echoDoingfoo. ;}}$ bar...