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? Link to comment https://forums.phpfreaks.com/topic/278465-how-to-return-twice/ Share on other sites More sharing options...
Irate Posted May 28, 2013 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. 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 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 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. Link to comment https://forums.phpfreaks.com/topic/278465-how-to-return-twice/#findComment-1432699 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.