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 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 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 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.