From: christian_m_caron at hotmail dot com Operating system: FreeBSD 4.8 PHP version: 4.3.2 PHP Bug Type: Unknown/Other Function Bug description: a recursive function doesn't return an expected string
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 bug report at http://bugs.php.net/?id=24234&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=24234&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=24234&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=24234&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=24234&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=24234&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=24234&r=support Expected behavior: http://bugs.php.net/fix.php?id=24234&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=24234&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=24234&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=24234&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24234&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=24234&r=dst IIS Stability: http://bugs.php.net/fix.php?id=24234&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=24234&r=gnused