Home > Backend Development > PHP Tutorial > Looking back suddenly - object-oriented

Looking back suddenly - object-oriented

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-29 08:59:13
Original
934 people have browsed it

After learning C and Java, I waited until I learned PHP. Today I finally understood what object-oriented is.
For example: a mobile phone is a class, the keyboard, battery, screen, etc. are member variables, and making phone calls, sending text messages, etc. are methods.
Object instantiation is like giving us all the functions of mobile phone A, converting the class into an object, and we (the object) can call any part of the mobile phone.
code:
class MyPc{
var $key;
public $name;
function vod(){
echo "php my favorite";
}
}
$pc1=new MyPc();//instantiation
$pc1->key="php";//Output php letters
echo $pc1->vod();//Output php my favorite

The above has introduced the suddenly looking back - object-oriented, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template