function not returning value
| From: | Mark Pelillo | Date: | Wed, 01 May 2002 02:09:29 +0000 |
| Subject: | function not returning value | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-95469@lists.php.net to get a copy of this message | ||
Why would the following function not return a value: (both $lastname and
$firstname are defined)
function get_handle($lastname, $firstname)
{
$handle_guess=$lastname;
$handle=array();
$fp=fopen('../truelies/userdb', "r");
while ($d=fgetcsv($fp, 250, ";")) {
$handle[] = $d[0];
}
fclose ($fp);
for ($i=0; $i<count($handle); $i++) {
if (strcmp($handle_guess, $handle[$i]) ==0) {
$j=1;
$handle_guess = $handle_guess . substr ($firstname,0,$j);
$j++;
}
}
return $handle_guess;
}
if I put an echo $handle_guess before or after the function then
nothing. So far the only way to make it work is
echo get_handle($lastname, $firstname);
which is not beautiful.
BTW is there a limit to the length of a command. If I can't figure this
out then I will have five or six of this "echo" statement concatanated
together.
Mar