Monkuar Posted May 28, 2013 Share Posted May 28, 2013 function test(){ return .= "test1"; return .= "test2"; } gives error, I need to return 2 things, to call on other functions, how? Quote Link to comment https://forums.phpfreaks.com/topic/278465-how-to-return-twice/ Share on other sites More sharing options...
Solution Irate Posted May 28, 2013 Solution Share Posted May 28, 2013 You can return an object and work with it in other functions, like you have an object defined and assigned to a variable, you return the variable and you can use all the methods you need. Quote Link to comment https://forums.phpfreaks.com/topic/278465-how-to-return-twice/#findComment-1432694 Share on other sites More sharing options...
Monkuar Posted May 28, 2013 Author Share Posted May 28, 2013 You can return an object and work with it in other functions, like you have an object defined and assigned to a variable, you return the variable and you can use all the methods you need. array would work then? ima try it Quote Link to comment https://forums.phpfreaks.com/topic/278465-how-to-return-twice/#findComment-1432695 Share on other sites More sharing options...
Monkuar Posted May 28, 2013 Author Share Posted May 28, 2013 return array('equiplist'=>$equipitems,'equiptooltip'=>$tooltipequiparray); BOOM!! EPIC! Thank u so much @Irate, Marked ur reply as best answer, ty sir Quote Link to comment https://forums.phpfreaks.com/topic/278465-how-to-return-twice/#findComment-1432697 Share on other sites More sharing options...
Irate Posted May 28, 2013 Share Posted May 28, 2013 Yeah, it should work with arrays and objects, but since I usually work with JavaScript, I return objects when possible. Quote Link to comment https://forums.phpfreaks.com/topic/278465-how-to-return-twice/#findComment-1432699 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.