What's the "FALSE" iteration of an array?
Posted: Sat Oct 26, 2002 8:39 am
I find PHP's flexibility in its handling of variables a little confusing at times.
(No, no, no. I'm not being critical.)
How, in the following function can I indicate by the return value that the file was not successfully opened?
Then in the use of the function I can do something like this:
To all the helpful people posting answers in this forum: thanks.
(No, no, no. I'm not being critical.)
How, in the following function can I indicate by the return value that the file was not successfully opened?
Code: Select all
function listall($name)
{
$f = fopen($name, "r");
if ($f != FALSE)
{ $a = fread($f, filesize($name)); // read the whole file
fclose($f);
$a = trim($a);
$r = explode("~", $a);
return $r;
}
else return ??????;
}Code: Select all
if (listall($Filename))
// do one thing
else // do something different