Jump to content

[SOLVED] Funciton Returning Values


CerealBH

Recommended Posts

 

 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

Link to comment
https://forums.phpfreaks.com/topic/89124-solved-funciton-returning-values/
Share on other sites

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]);

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.