seamus
seamus

Reputation: 2901

PHP, How to select an array in an object in an array

$result = array(1) { [0]=> object(stdClass)#193 (6) { 
["address"]=> string(34) "1PLqeSk7ebVWj4QapBxQ4AyCD2ysfN4CBM" 
["coinbase"]=> bool(false) ["height"]=> int(514260) 
["prevout_hash"]=> string(64) "94dcf79b76f66562d9c3a1f1d581fae3314d97833d1a58ec3ba8cb678098fa0c" 
["prevout_n"]=> int(0) ["value"]=> string(5) "0.001" } }

Hey all,

I am sshing into a server and the above is the returned de_coded Json.

Am am having a hard time pulling information off if it.

echo result[0]object["address"];

Thanks in advance

Upvotes: 0

Views: 56

Answers (1)

B. Desai
B. Desai

Reputation: 16446

Object can be access using ->. So From your array you can get address by doing following code:

echo $result[0]->address;

http://php.net/manual/en/sdo.sample.getset.php

Upvotes: 3

Related Questions