you're only returning the value, and not setting the global variable
you could place a "global $handle_guess:" as the first line of your function
or you could do "$handle_guess = get_handle($lastname, $firstname);"

-----Original Message-----
From: Mark Pelillo [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 01, 2002 12:09 PM
To: PHP help
Subject: [PHP] function not returning value

Why would the following function not return a value: (both $lastname and
$firstname are defined)

function get_handle($lastname, $firstname)
$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) {
                                $handle_guess = $handle_guess . substr
        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


PHP General Mailing List (
To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to