This article mainly shares with you the concepts of PHP classes and objects, mainly in the form of code. I hope it can help you.
Object-oriented –>About array programming
class People { public $name = 'nobody'; public function cry() { echo '呱呱坠地'; } }$a = new People(); print_r($a);echo $a->name,'<br />',$a->height,'<br />';$b = array('name'=>'nobodyB','height'=>'40B');echo $b['name'],'<br >',$b['height'];echo '<br >';// ===对象调用其方法(函数)=== //$a->cry();
Related recommendations:
Classes and Detailed explanation of object inheritance
Detailed explanation of classes and objects (inheritance) in php_php examples
Detailed explanation of classes and objects in php
The above is the detailed content of The concept of PHP classes and objects. For more information, please follow other related articles on the PHP Chinese website!