|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[1999-12-21 22:38 UTC] schmit at athenet dot net
I've been trying to get some user-defined functions to work in 4.0b3, and they all fail with variants of the following:
function rdfl($fname) {
if ($fname = "") {
return("No data");
} else {
return(readfile($fname));
}
}
echo rdfl("/home/download/finger.inc");
This returns an error indicating no such file "". Which is TOTALLY bizzare since the $fname check should fail it then, but instead it drops into the readfile routine with a null string. What's up with that?
Another example:
function tstostr($timestamp,$fmt) {
echo $timestamp . " (" . $fmt . ")";
...do some twiddling with regex...
return(date($fmt,twiddled parameters));
}
echo tstostr($dbresult["dt"],"d/m/Y");
This echos out something along the following lines:
19992112 ()
Indicating the second parameter is empty, but even if I try to catch the empty parameter and replace with a default value, the paramter catch is ignored like there's data in the parameter, but anytime I try to manipulate the second parameter, I get a null string.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 10 10:00:02 2026 UTC |
if($fname == "") { ... } Note the == instead of = there