CerealBH Posted February 3, 2008 Share Posted February 3, 2008 function grab_f_info($f_id) { $f_url = "http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=$f_id"; $this->newLocation($f_url); preg_match("<img border=\"0\" alt=\"\" src=\"(.*)\" />", $this->pageSource, $image); preg_match('/<span class="redbtext">(.*)<\/span>/', $this->pageSource, $friends); return $friends[1]; return $image[1] } dunno if its suppoused to look something like this $???? = $myspace->grab_f_info($f_id); need to return $friends[1] and $image[1] pref back to a array if possible ive tried googling it but i just find for returning 1 value Quote Link to comment https://forums.phpfreaks.com/topic/89124-solved-funciton-returning-values/ Share on other sites More sharing options...
trq Posted February 3, 2008 Share Posted February 3, 2008 The only way you can return more than one value is to return an array. <?php function grab_f_info($f_id) { $f_url = "http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=$f_id"; $this->newLocation($f_url); preg_match("<img border=\"0\" alt=\"\" src=\"(.*)\" />", $this->pageSource, $image); preg_match('/<span class="redbtext">(.*)<\/span>/', $this->pageSource, $friends); return array($friends[1],$image[1]); } Quote Link to comment https://forums.phpfreaks.com/topic/89124-solved-funciton-returning-values/#findComment-456447 Share on other sites More sharing options...
marcus Posted February 3, 2008 Share Posted February 3, 2008 do like too things. function grab_f_info($f_id,$find){ if($find == 'friends'){ return $friends[1]; }else { return $image[1]; what thorpe says works too Quote Link to comment https://forums.phpfreaks.com/topic/89124-solved-funciton-returning-values/#findComment-456448 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.