Thursday, May 12, 2011

Type Hinting

more info.. http://evergreenphp.blogspot.com

Type Hinting
PHP 5 introduces Type Hinting. Functions are now able to force parameters to be objects (by
specifying the name of the class in the function prototype) or arrays (since PHP 5.1). However, if
NULL is used as the default parameter value, it will be allowed as an argument for any later call.
var;
}/**
* Another test function
** First parameter must be an array
*/
public functiontest_array(array$input_array) {
print_r($input_array);
}
}// Another example class
classOtherClass {
public$var = 'Hello World';
}?>

No comments: