http://www.php.net/manual/en/language.variables.scope.php




On Tuesday 30 April 2002 19:09 pm, you wrote:
> 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

-- 
He who learns must suffer.

Aeschylus

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to