Page 1 of 1

Return array from function

Posted: Thu Oct 01, 2009 9:07 pm
by dgkindy
I am trying to return a couple variables from a function. I am getting the following error.

Error Message

Parse error: parse error in D:\Documents and Settings\414004425\My Documents\My Websites\PETdb\md4c5.php on line 177

Code: Select all

Function purchase_request($string) {
        return array($pr1, $pr2) = explode("/",$string);   
    }
I have been looking at the book and cannot see the problem. What am I misssing?

Re: Return array from function

Posted: Thu Oct 01, 2009 9:17 pm
by requinix

Code: Select all

return explode("/", $string);
explode() returns an array already. Don't mess with it.

Re: Return array from function

Posted: Fri Oct 02, 2009 8:06 am
by dgkindy
That did it thanks for the help