Jump to content

[SOLVED] Need help with functions!


david212

Recommended Posts

I need to count how many .txt files are in my folder, i created this code but it doesn't work. Can anyone help me?

 

 

<?php

 

 

 

 

$txtfils = array();

 

$f = opendir("fold");

 

while(($txtfils[]=readdir($f)));

 

 

 

$s = sizeof($txtfils);

 

$abc=0;

for($i = 0;$i<$s;$i++){

 

 

 

if($txtfils[$i]==".txt"){

 

 

$abc++;

}

echo($abc);

}

?>

 

Thankx

Link to comment
https://forums.phpfreaks.com/topic/146877-solved-need-help-with-functions/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.