property_exists

This function checks if the given property exists in the specified class (and if it is accessible from the current scope).

It returns TRUE if the property exists, FALSE if it doesn’t exist or NULL in case of an error.

<?php
 $a = array('a'=>'a', 'b'=>'c');
 echo property_exists((object) $a, 'a')?'true':'false';
 ?>

true-true will be the output

Share

Leave a Reply

Your email address will not be published. Required fields are marked *