note 97538 deleted from function.property-exists by peehaa

From: Date: Tue, 10 Sep 2013 18:28:15 +0000
Subject: note 97538 deleted from function.property-exists by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-196216@lists.php.net to get a copy of this message
Note Submitter: webmaster at thedigitalorchard dot ca ---- According to my tests, isset() is 4 times faster than property_exists(), so use a combination of these functions in your programming for best performance. For example: <?php $fld = 'somevar'; if (isset($this->$fld) || property_exists($this, $fld)) { } ?> If your programming routinely checks a larger number of property names that are expected to exist, whereas a smaller number may not, then using isset(), as above, will result in faster execution of the programming.

« previous php.notes (#196216) next »