ID: 44579 Updated by: [EMAIL PROTECTED] Reported By: alex at raintree dot ee -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: Windows Server 2003 PHP Version: 5.2CVS-2008-03-31 (snap) New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2008-03-31 12:47:14] alex at raintree dot ee Description: ------------ Noticed serious performance issues while reading non-existing values from multi-dimensional array. Adding ISSET() check before the array read makes the script at least 3 times faster. However the main concern is that there are lots of non-optimized scripts that do not have ISSET() around multi-dimensional arrays. Reproduce code: --------------- error_reporting(0); $start = date('H:m:s'); $myArr = array('a'); $test = 'a'; // performance killer loop for($i = 0; $i < 1000000; $i++) if ($myArr[$test][$fieldName] == 5); /* optimized code if (isset($myArr[$test][$fieldName]) && $myArr[$test][$fieldName] == 5) */ $end = date('H:m:s'); echo $start . ' ' . $end; Expected result: ---------------- I expect the code with ISSET (commented out) run close to as fast as the code without ISSET. Actual result: -------------- Serious performance difference while running code that has ISSET() around multi-dimensional array read vs. code without ISSET(). ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44579&edit=1
