|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-12-08 21:53 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 29 07:00:01 2025 UTC |
Description: ------------ Why return functions in recursive functions doesn't exit and return value from function but instead loops until end of loop? Reproduce code: --------------- <?php function check_folder($directory){ if ($dir = @opendir($directory)){ while ($file = readdir($dir)) { if (($file != ".")&&($file != "..")) { $tempDir = $directory."/".$file; if (is_dir($tempDir)) { check_folder($tempDir); } else { $file_name = $directory."/".$file; $file_in_use=check_in_resources($file_name); if ($file_in_use!=false){ / return 1; } } } } } return 0; } Expected result: ---------------- i expected function to return 1 when var $file_in_use!=false. but it everytime returns 0 Actual result: -------------- i expected function to return 1 when var $file_in_use!=false. but it everytime returns 0