PHP Polygon objects: Declaring classes and instantiating classes

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.