Edit report at https://bugs.php.net/bug.php?id=62165&edit=1
ID: 62165 User updated by: coreyavis at gmail dot com Reported by: coreyavis at gmail dot com Summary: Array key bug Status: Open Type: Bug Package: Unknown/Other Function -Operating System: Windows 7 +Operating System: linux PHP Version: Irrelevant Block user comment: N Private report: N New Comment: I put my home computer operating system, and not the host server operating system. Previous Comments: ------------------------------------------------------------------------ [2012-05-26 10:14:53] coreyavis at gmail dot com Description: ------------ --- >From manual page: http://www.php.net/function.array-search --- When using the array_search function to find the key of a value, and then making that key a variable, other functions don't recognize the key 0 (zero) as a valid variable. I have PHP version 5.2.17 but was unable to upgrade cause I host with another company. Test script: --------------- $array1 = array('value1'); $array2 = array('value1'); for ($x=0; $x<1; $x++) { if (($key = array_search($array2[$x], $array1)) != false) { unset($array1[$key]); } } /* value1 should no longer be in array, but it is. */ print_r($array1); Expected result: ---------------- $array1 should no longer contain 'value1'. ([0] => ) Actual result: -------------- $array1 still contains 'value1'. ([0] => 'value1') ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62165&edit=1