IMPRESS dotted_line CONTACT dotted_line search dotted_line Kontakt dotted_line sitemap dotted_line print
161 PHP-Resource users online

Switch to another languags Deutsch aktuelle Sprache Englisch

PHP Manual


(PHP 5 >= 5.1.0)

property_exists Checks if the object or class has a property


bool property_exists ( mixed $class , string $property )

This function checks if the given property exists in the specified class.


As opposed with isset(), property_exists() returns TRUE even if the property has the value NULL.



The class name or an object of the class to test for


The name of the property

Return Values

Returns TRUE if the property exists, FALSE if it doesn't exist or NULL in case of an error.



Using this function will use any registered autoloaders if the class is not already known.


The property_exists() function cannot detect properties that are magically accessible using the __get magic method.


Version Description
5.3.0 This function checks the existence of a property independent of accessibility.


Example #1 A property_exists() example


class myClass {
    static protected 

    static function 
test() {
var_dump(property_exists('myClass''xpto')); //true

var_dump(property_exists('myClass''mine'));   //true
var_dump(property_exists(new myClass'mine')); //true
var_dump(property_exists('myClass''xpto'));   //true, as of PHP 5.3.0
var_dump(property_exists('myClass''bar'));    //false
var_dump(property_exists('myClass''test'));   //true, as of PHP 5.3.0


See Also

Comments to the PHP manual
Write new comment


New Tutorial entries

Migration einer PHP 5 App auf PHP 7

Dieses PHP 7 Tutorial zeigt dir, wie du dein PHP5 Script auf PHP7 umstellst.

Berni | Category: PHP
PHP 7 Virtual Machine

Dieser Artikel zielt darauf ab, einen Überblick über die Zend Virtual Machine, wie es in PHP 7 gefunden wird.

Berni | Category: PHP
plotting masters - a professional guide - Teil II

Grafische Interpolation und Bestapproximation von numerischen Wertepaaren: Wir wollen Punkte auf einer Zeichenebene über verschiedene Verfahren miteinander verbinden.

EVAMasters | Category: PHP