ID: 24234 Updated by: [EMAIL PROTECTED] Reported By: christian_m_caron at hotmail dot com -Status: Open +Status: Bogus Bug Type: Unknown/Other Function Operating System: FreeBSD 4.8 PHP Version: 4.3.2 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 You don't do anything with the return value of the recursive call to search_array(). Please ask on a support forum such as php-general if you need more help with this. Previous Comments: ------------------------------------------------------------------------ [2003-06-17 21:47:05] christian_m_caron at hotmail dot com Description: ------------ The recursive function looks in an array for a certain text. When it finds it, it returns the text. The problem is that it never returns it (but if I put a print statement instead of a return, it will print it). Reproduce code: --------------- $arr = array('0'=>array('0'=>'zero-zero','1'=>'zero-un'), '1'=>array('0'=>'un-zero','1'=>'un-un')); print search_array('zero-un', $arr); function search_array ($page, $item) { if (is_array($item)) { foreach ($item as $k => $v) { if (is_array($v)) { search_array($page, $v); } elseif ($v == $page) { return $v; } } } else { return "Not an array!"; } } Expected result: ---------------- zero-un Actual result: -------------- Nothing! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24234&edit=1