note 72788 added to function.empty

From: Date: Thu, 01 Feb 2007 20:39:28 +0000
Subject: note 72788 added to function.empty
Groups: php.notes 
Request: Send a blank email to php-notes+get-122487@lists.php.net to get a copy of this message
In response to a previous post regarding the speed of: if (empty($var)) versus if (!$var) or if (!empty($var)) versus if ($var) In fact I found that the empty() function is always slower. I have tested this on three different machines; Celeron, Pentium M, and an AMD Athlon 64. These all run php 5.2, and I have repeated the tests a number of times using different loops and variable types. My results show that, on average, empty() takes around 15 - 20% longer to complete its task. ---- Server IP: 81.92.200.26 Probable Submitter: 87.196.42.137 ---- Manual Page -- http://www.php.net/manual/en/function.empty.php Edit -- https://master.php.net/note/edit/72788 Del: integrated -- https://master.php.net/note/delete/72788/integrated Del: useless -- https://master.php.net/note/delete/72788/useless Del: bad code -- https://master.php.net/note/delete/72788/bad+code Del: spam -- https://master.php.net/note/delete/72788/spam Del: non-english -- https://master.php.net/note/delete/72788/non-english Del: in docs -- https://master.php.net/note/delete/72788/in+docs Del: other reasons-- https://master.php.net/note/delete/72788 Reject -- https://master.php.net/note/reject/72788 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#122487) next »