note 85359 modified in function.property-exists by felipe
| From: | felipe@php.net | Date: | Thu, 28 Aug 2008 13:42:15 +0000 |
| Subject: | note 85359 modified in function.property-exists by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-143938@lists.php.net to get a copy of this message | ||
The above PHP4 function did not work for me. This does:
<?php
if ( !function_exists( 'property_exists' ) ) {
function property_exists( $class, $property ) {
if ( is_object( $class ) ) {
$vars = get_object_vars( $class );
} else {
$vars = get_class_vars( $class );
}
return array_key_exists( $property, $vars );
}
}
?>
--was--
The above PHP4 function did not work for me. This does:
if ( !function_exists( 'property_exists' ) ) {
function property_exists( $class, $property ) {
if ( is_object( $class ) ) {
$vars = get_object_vars( $class );
} else {
$vars = get_class_vars( $class );
}
return array_key_exists( $property, $vars );
}
}
http://php.net/manual/en/function.property-exists.php