note 97538 added to function.property-exists

From: Date: Sun, 25 Apr 2010 04:56:18 +0000
Subject: note 97538 added to function.property-exists
Groups: php.notes 
Request: Send a blank email to php-notes+get-168610@lists.php.net to get a copy of this message
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. ---- Server IP: 66.207.199.35 Probable Submitter: 65.110.28.158 ---- Manual Page -- http://www.php.net/manual/en/function.property-exists.php Edit -- https://master.php.net/note/edit/97538 Del: integrated -- https://master.php.net/note/delete/97538/integrated Del: useless -- https://master.php.net/note/delete/97538/useless Del: bad code -- https://master.php.net/note/delete/97538/bad+code Del: spam -- https://master.php.net/note/delete/97538/spam Del: non-english -- https://master.php.net/note/delete/97538/non-english Del: in docs -- https://master.php.net/note/delete/97538/in+docs Del: other reasons-- https://master.php.net/note/delete/97538 Reject -- https://master.php.net/note/reject/97538 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#168610) next »