HappyPandaFace Posted August 12, 2007 Share Posted August 12, 2007 I need a function in PHP that will output the amount of files in a certain folder from a website Link to comment https://forums.phpfreaks.com/topic/64464-length-function/ Share on other sites More sharing options...
balistic Posted August 12, 2007 Share Posted August 12, 2007 just curious whats that got to do with length <?php $path = "./"; if ($handle = opendir($path)) { while (false!== ($file = readdir($handle))) { if (!is_dir($path. $file)) { $filecount++; } } closedir($handle); echo ('Total Files Hosted'); echo ('.$filecount.'); } ?> Link to comment https://forums.phpfreaks.com/topic/64464-length-function/#findComment-321392 Share on other sites More sharing options...
HappyPandaFace Posted August 12, 2007 Author Share Posted August 12, 2007 I thought it would be like a .length function, which I think is used to count the number of lines in an array in PHP. Although it could be action script. Link to comment https://forums.phpfreaks.com/topic/64464-length-function/#findComment-321408 Share on other sites More sharing options...
balistic Posted August 12, 2007 Share Posted August 12, 2007 its more to do with the length of a string, and yes your welcome. Link to comment https://forums.phpfreaks.com/topic/64464-length-function/#findComment-321412 Share on other sites More sharing options...
HappyPandaFace Posted August 12, 2007 Author Share Posted August 12, 2007 Oh yea, thx. Link to comment https://forums.phpfreaks.com/topic/64464-length-function/#findComment-321413 Share on other sites More sharing options...
HappyPandaFace Posted August 14, 2007 Author Share Posted August 14, 2007 Sorry it took me so long, I couldn't test your code immediately. I tried it but it came up with this output: Warning: opendir(/testfiles/test/) [function.opendir]: failed to open dir: No such file or directory in /testfiles/lengthtest.php on line 4 Do you know what the problem is? EDIT: and the length function is a part of actionscript in Flash Link to comment https://forums.phpfreaks.com/topic/64464-length-function/#findComment-323216 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.