Syntax
| property_exists ( $object, $property ); |
Definition and Usage
This function checks if the given property exists in the specified class (and if it is accessible from the current scope).
Paramters
| Parameter | Description |
|---|---|
| object | Required. The tested object |
| property | Required. The name of the property. |
Return Value
Returns TRUE if the property exists, FALSE if it doesn't exist or NULL in case of an error.
Example
Following is the usage of this function:
<?php
class Test {
public $property;
public foo() { echo($property); }
}
property_exists('Test', 'property'); // will return true
property_exists('Test', 'Property'); // will return false
?>
|
No comments:
Post a Comment