Some new features in PHP5

xiaoxiao2021-03-06  62

/ ***************************** / Author: old Youth E_MAIL: wenadmin@sina.com / ****** ********************** /

PHP5 has added a lot of new functions and features, but there is no reflection in the current latest CHM manual, to find it in the online manual! ! !

Not much nonsense, let's see what new Class compares the Class of PHP2 in PHP5.

1 / Add access to access: Characteristics using private / public / protected

2 / Join the interface and abstract classes, Interface / Abstract, unfortunately, the inheritance of the class is still a tree-shaped single service.

3 / You can define the final function and cannot override this function in the parent class.

4 / Finally, the static variable can be defined in the class, and can only be defined in the function in the PHP.

Static $ AA = NULLL;

Also provided a Const method

Const myStatic = 'aaaaaa';

5 / Newly provided a Self internal method

echo self :: mystatic;

6 / Added the following internal features

__construct () initialization

__destruct (); uninstall

__get (); organization returns certain variables in the class.

__set (); the organization assigns some variable values ​​in the class.

__call (); When the function of calling the class does not exist, the method is handled

__clone (); Copy object

__sleep (); serialization

__Weekup (); when the definition is used

7 / Default Object's assignment uses the way applications, such as:

$ Object2 = $ Object1

$ Object2 gets a reference to the Object1, not in memory copy copy

8 / Provide the Reflection API, mainly used to display the structure and statistics of Class / Function, this is a brand new thing, it is difficult to say clearly, (although it is very powerful, I still don't find "this hero can be used local")

9 / Provide a enumeration function for the Class object, you can use the for loop to process global variables in the object.

10 / Provide a __autoload (); function, use to automatically load class declaration file

Details: http://www.php.net/manual/en/language.oop5.basic.php

转载请注明原文地址:https://www.9cbs.com/read-118808.html

New Post(0)