rbrown Posted February 28, 2008 Share Posted February 28, 2008 I got it to return a single array by calling: Parse_Custom_Fields($input,&$first_array){... But I need it to return a second array but I can't get the first section right. I tried: Parse_Custom_Fields($input,&$first_array&$second_array){... Parse_Custom_Fields($input,&$first_array,&$second_array){... Parse_Custom_Fields($input,&$first_array,$second_array){... How do I do this? I don't want to add it to the first array if I don't have to. Thanks, Link to comment https://forums.phpfreaks.com/topic/93550-returning-two-arrays-from-a-function/ Share on other sites More sharing options...
tinker Posted February 28, 2008 Share Posted February 28, 2008 Your way of using references should work but you can always fall back to: ... return array($a, $b); } list($a, $b) = myfunc(); I presume you've looked at this... http://uk2.php.net/manual/en/language.references.php Link to comment https://forums.phpfreaks.com/topic/93550-returning-two-arrays-from-a-function/#findComment-479393 Share on other sites More sharing options...
rbrown Posted February 28, 2008 Author Share Posted February 28, 2008 Doh! You are right... This worked... Parse_Custom_Fields($input,&$first_array,&$second_array){... I had a typo when I was calling the function... Wasn't paying attention to the error message.... Tired.... been programming since 1am. I think it's time for a nap. Thanks... Link to comment https://forums.phpfreaks.com/topic/93550-returning-two-arrays-from-a-function/#findComment-479415 Share on other sites More sharing options...
tinker Posted February 28, 2008 Share Posted February 28, 2008 I assuming your using different variable names in your real code because you've got that example up there. Either way, very good... Link to comment https://forums.phpfreaks.com/topic/93550-returning-two-arrays-from-a-function/#findComment-479417 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.