I. Declarations of classes
1 //declare a class using the class keyword + the name +{}2 classDemo {//the first letter of the class name needs to be capitalized, the name follows the hump naming method3 var $name;//[modifier] Variable name4 5 functionTest () {6 Echo"HelloWorld";7 }8 }9 Ten //instantiating objects, using new keywords One $t 1=NewDemo; A - //Access to Objects - $p 1->test ();
Ii. allocation of classes in memory
Data segments typically refer to global variables, such as static variables and constants, that are initialized and not 0 in the program.
Code snippets usually refer to a piece of memory, such as functions and methods, that is used to store program execution code.
Stack memory storage occupies the same space length and occupies a small space of data types, such as Integer 1,10,100,1000,10000,100000 and so on, in memory occupy space is equal, are 64 bits 4 bytes;
The length of the heap memory data is variable, and the data of the data type with large space is occupied;
PHP Polygon objects: Declaring classes and instantiating classes