TAILIEUCHUNG - OBJECT-ORIENTED PHP Concepts, Techniques, and Code- P20

OBJECT-ORIENTED PHP Concepts, Techniques, and Code- P20:A number of years ago, before I started using PHP, I created dynamic web pages using C. This really wasn’t too different from some of the other options available at the time, though it seems almost unthinkable now. Creating a dynamic page meant outputting HTML from your script and recompiling that script if any changes needed to be made. | PHP 5 PHP 4 Notes Operators function foo variable function foo variable Note that this example shows a function declaration not a function call. Passing objects by reference explicitly is recommended in PHP 4 but not required in PHP 5 because objects are automatically passed by reference. In PHP 5 you only ever need use a reference as a parameter with non-objects. foo var Deprecated. Call-time pass by reference is deprecated in PHP 5. For more information see Appendix A. Use a reference in the function definition when passing non-objects not required for objects as noted above . In PHP 5 assignment of objects is equivalent to assignment by reference under PHP 4. obj new ClassName obj new ClassName In PHP 5 new automatically returns a reference. PHP 4 style is deprecated. clone In PHP 4 assignment clones an object. instanceof is_a is_a is the only function of the Class Object functions that has been deprecated as of PHP 5 . Other Changes of Interest get class get class In PHP 5 these methods return a get_class_methods and get_parent_class get_class_methods and get_parent_class case-sensitive result. functionName ObjectType o N A In PHP 5 you may type hint object parameters to functions. As of PHP you may also type hint arrays. Type hinting return values of functions or methods is also planned. This will of course only apply to objects. Conversion Table PHP 4 and PHP 5 171 GLOSSARY A abstract method A method that is declared but not defined. Any class that contains an abstract method must use this keyword in the class definition. All of the methods of an interface are abstract. A class that has only abstract methods is a pure abstract class. accessor method A public method used to retrieve or change data members. Accessor methods are also called get and set methods. It is considered good programming practice to make data members private and alter or retrieve them only through accessor methods. aggregate class A class having at least one data member that is itself

30    9    0    14-08-2020
6    7    0    14-08-2020
42    4    0    14-08-2020
9    5    0
5    6    0
259    7    0