LoneStarJack Posted February 2, 2014 Share Posted February 2, 2014 I am trying to use class StockMarketAPI and have a problem with acessing the return variable. foreach( $list_of_stocks as $sym){ $StockMarketAPI = new StockMarketAPI; $StockMarketAPI->symbol = $sym; $StockMarketAPI->stat = 'price'; print_r($StockMarketAPI->getData()); The print_r line returns : AA Array ( [price] => 11.885 ) echo '<br>'. $sym. ' ' . $data['price']; I have tried everything I know to capture the "$data['price'] // add update database table here with the returned price}; Link to comment https://forums.phpfreaks.com/topic/285879-class-stockmarketapi/ Share on other sites More sharing options...
ignace Posted February 3, 2014 Share Posted February 3, 2014 $data = $StockMarketAPI->getData(); echo $data['price']; Link to comment https://forums.phpfreaks.com/topic/285879-class-stockmarketapi/#findComment-1467510 Share on other sites More sharing options...
LoneStarJack Posted February 3, 2014 Author Share Posted February 3, 2014 Thanks Perfect answer Link to comment https://forums.phpfreaks.com/topic/285879-class-stockmarketapi/#findComment-1467535 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.