PHP | |
Function Example | function inc($val) Procedures are functions that return no value. |
Class Example | class parent { |
Scope of Variables | Variables defined outside a function or class are available globally; variables defined in a class or function are available locally.Unlike other languages, you must declare a global variable in a function or class before you use the variable, using the keyword global. $globalvar = 1; |
Call by Reference | Use & keyword in function parameters. |
Default Parameters | Yes.function A(param1=”abc”) |
Returning by Reference | By default, return is by value. For objects and arrays, we want to return by reference for superior performance. Use function & getarray123() { Then in the calling code, use $val = &getarray123(); |
Sunday, May 27, 2007
Function and Class Syntax
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment