note 72788 deleted from function.empty by didou

From: Date: Sun, 18 May 2008 00:56:05 +0000
Subject: note 72788 deleted from function.empty by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-139476@lists.php.net to get a copy of this message
Note Submitter: Chris Baynes ---- 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.

« previous php.notes (#139476) next »