Demonic Posted September 19, 2006 Share Posted September 19, 2006 is it this correct?[code]<?phpfunction connect($localhost,$username,$password,$database);mysql_connect('$localhost','$username','$password') or die(mysql_error));mysql_select_db('$database') or die(mysql_error());return $localhost,$username,$password,$database;}?>[/code] Link to comment https://forums.phpfreaks.com/topic/21321-returning-more-then-one-thing-in-a-function/ Share on other sites More sharing options...
Barand Posted September 19, 2006 Share Posted September 19, 2006 No.You can only return a single value, however that value can be an array. So you couldreturn array($localhost,$username,$password,$database);But in that case, having passed those values to the function and they remain unchanges in the function, where's the point in then returning them again? Link to comment https://forums.phpfreaks.com/topic/21321-returning-more-then-one-thing-in-a-function/#findComment-94932 Share on other sites More sharing options...
Demonic Posted September 19, 2006 Author Share Posted September 19, 2006 so changing what i have to:return array($localhost,$username,$password,$database);would work? Link to comment https://forums.phpfreaks.com/topic/21321-returning-more-then-one-thing-in-a-function/#findComment-94941 Share on other sites More sharing options...
Barand Posted September 19, 2006 Share Posted September 19, 2006 Pointless, but should work. Link to comment https://forums.phpfreaks.com/topic/21321-returning-more-then-one-thing-in-a-function/#findComment-94943 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.