I have a function and I need it to return two arrays.
I know a function can only return one variable .. is there a way to return my two arrays?
If I concatenate them, how can I separate them cleanly when out of the function?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No need to concatenate: just return array of two arrays, like this:
… then you will be able to assign these arrays to the local variables with list, like this:
And if you work with PHP 5.4, you can use array shortcut syntax here as well: