I'll assume the & is legit (never used it in PHP personally)

here is a restructured function assuming all your provided code does what you
want

!untested!

function &getpath($search) {
        # removed $path and $search...  $search is already passed
        # and you are only using $path in the function
        $a = `/bin/ls -al /home/sites/ | awk {'print $9" "$10" "$11" "'} |
        grep $search`;
        $items = explode ("www.", $a);
        For($i = 0; $i< (count($items)/1); $i +=1){
                $path[]=strstr(($items[$i]), '/'); #you are doing this
                        # multiple times, and unless you want to keep
                        # overwriting the $path variable you need to
                        # create an array
        }
        return $path; # last thing to do is return your values
}


$path=&getpath($search);

>-----Original Message-----
>From: Richard Kurth [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, August 21, 2001 5:46 PM
>To: php
>Subject: [PHP] Returning info from a function
>
>
>Could somebody tell me way this function will not work I know the
>script inside the function works because I have tested it but when I
>put it in a function all I get back when I call it is a 1
>
>
>function &getpath($search) {
>Global $search,$path;
>$a = `/bin/ls -al /home/sites/ | awk {'print $9" "$10" "$11" "'} |
>grep $search`;
>$items = explode ("www.", $a);
> For($i = 0; $i< (count($items)/1); $i +=1){
> $path=strstr(($items[$i]), '/');
> return $path;
>}
>}
>
> $path=&getpath($search);
>
>
>
>
>
>
>
>
>
>
>
>
>
>Best regards,
> Richard
>mailto:[EMAIL PROTECTED]
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to