phpretard Posted April 17, 2008 Share Posted April 17, 2008 I can't figure why this displays nothing but error. I am trying to count the number of files in a specified folder. $dirname = "ALBUMS/".$loc; function num_files($dirname) { return count(glob($dirname)); } echo num_files(); Here is the error: Warning: Missing argument 1 for num_files(), Quote Link to comment Share on other sites More sharing options...
rhodesa Posted April 17, 2008 Share Posted April 17, 2008 $dirname needs to be passed as an argument to the function, as it is not in the same scope as the function: <?php $dirname = "ALBUMS/".$loc; function num_files($dirname) { return count(glob($dirname)); } echo num_files($dirname); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.