$btcbsUSD = getPricebs(‘https://www.bitstamp.net/api/ticker/’);
$btcbsPrice = $btcbsUSD[“last”];
$btcbsVol = $btcbsUSD[“volume”]; // added line for volume here
$btcbsDisplay = round($btcbsPrice, 2);
$btcbsVol = round($btcbsVol, 2);[/code]
This code is grabbing rates from a table. I’d like the outputs $btcbsDisplay and $btcbsVol to be global so I can access them from any page with a quick reference to the variable…. It seems reletively easy, as the guide suggest to define the variables outside the function but i am not exactly sure which ones i need to define for my case.
Hey guys,
I have read the codex guides and i am still a little confused on changing my variable function to have global output
[code title=””]function getPricebs($url) {
$decode = file_get_contents($url);
return json_decode($decode, true);
}
$btcbsUSD = getPricebs(‘https://www.bitstamp.net/api/ticker/’);
$btcbsPrice = $btcbsUSD[“last”];
$btcbsVol = $btcbsUSD[“volume”]; // added line for volume here
$btcbsDisplay = round($btcbsPrice, 2);
$btcbsVol = round($btcbsVol, 2);[/code]
This code is grabbing rates from a table. I’d like the outputs $btcbsDisplay and $btcbsVol to be global so I can access them from any page with a quick reference to the variable…. It seems reletively easy, as the guide suggest to define the variables outside the function but i am not exactly sure which ones i need to define for my case.
Thank you!
Members Only Content
This reply is for PremiumPress customers only.
Login NowMembers Only Content
This reply is for PremiumPress customers only.
Login NowMembers Only Content
This reply is for PremiumPress customers only.
Login Now