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}; Quote 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 (edited) $data = $StockMarketAPI->getData(); echo $data['price']; Edited February 3, 2014 by ignace Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/285879-class-stockmarketapi/#findComment-1467535 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.