Posted: Wed Apr 12, 2006 5:26 pm
Well ya. You're creating the $date variable instead of the $filename variable. If no $filename variable is being instantiated, its certainly not going to print out.
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<?php
$arrayFiles=glob('*.*');
$date=date ("F d Y H:i:s.", filemtime($filename));
if($date){
foreach ($date as $filename) {
echo "$filename <br>";
}
}
else
echo"File not found."
?>Code: Select all
Warning: Invalid argument supplied for foreach() in /host/htdocs/vuns/index.php on line 5Come on dude you know you can do a little more reading aroundozzy wrote:Sould i t look like this?If so, it is returning this error:Code: Select all
<?php $arrayFiles=glob('*.*'); $date=date ("F d Y H:i:s.", filemtime($filename)); if($date){ foreach ($date as $filename) { echo "$filename <br>"; } } else echo"File not found." ?>Code: Select all
Warning: Invalid argument supplied for foreach() in /host/bluemicro.digibase.ca/htdocs/vuns/index.php on line 5
Code: Select all
foreach ($some_array as $value)
{
//Look at each value in the array and tore it temporarily in $value
}
foreach ($some_array as $key => $value)
{
//In an array like:
// $some_array['foo'] = 'bar';
// Look at each key (foo) and each value (bar)
}Code: Select all
Warning: Invalid argument supplied for foreach() in /host/htdocs/vuns/index.php on line 5