Home > Backend Development > PHP Tutorial > The concept of PHP classes and objects

The concept of PHP classes and objects

小云云
Release: 2023-03-22 21:16:02
Original
1223 people have browsed it

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.

The concept of PHP classes and objects

Object-oriented –>About array programming

class People {
    public $name = 'nobody';    public function cry() {
        echo '呱呱坠地';
    }
}$a = new People();

print_r($a);echo $a->name,&#39;<br />&#39;,$a->height,&#39;<br />&#39;;$b = array(&#39;name&#39;=>&#39;nobodyB&#39;,&#39;height&#39;=>&#39;40B&#39;);echo $b[&#39;name&#39;],&#39;<br >&#39;,$b[&#39;height&#39;];echo &#39;<br >&#39;;// ===对象调用其方法(函数)=== //$a->cry();
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template