json - php read from array inside class -
when use print_r response api url got following result:
stdclass object( [messages] => array ( [0] => stdclass object ( [messageid] => 990950058 [recipient] => 966000000000 [status] => queued ) [1] => stdclass object ( [messageid] => 990950059 [recipient] => 966500000000 [status] => queued ) ) [numberofunits] => 1 [cost] => 0.00000 [balance] => 2.89050 [timecreated] => 2016-11-10 14:03:49 [currencycode] => sar
)
the problem want make loop read values messageid how can it?
so simple use foreach
used loop through each key/value pair
foreach($your_variable->messages $row) { echo $row->messageid; }
Comments
Post a Comment