How can I call a variable from another file? Is it possible for a function to return 5 values? In my function.php file I grab a lot of values in different variables. For instance lets look at the function below
Function.php file
function getID($url)
{
global $link;
$ch = curl_init("http://example.com/?id=".$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$raw = curl_exec($ch);
curl_close($ch);
$data = json_decode($raw);
$id=$data->id;
$cname=$data->name;
$info=$data->client_info;
$up=$data->voteup;
$cat=$data->category;
return $id;
}
index.php file
$myid=getID($url);
echo "My ID : " . $myid; -->This is working but not the below four....
echo "Client Name : "
echo "Information : "
echo "Up Votes : "
echo "Category : "
I do not want to keep everything in one file. In the index.php file, I also want to output 'cname', 'info', 'up', 'cat' values under 'myid'. I was thinking of making 4 different functions and get them one by one in the index.php file. Is there a better way like instead of returning only $id, the getID function can return the other four parameters too? Please advice.