PHP : What is the better way to access object inside an array then what i got now ?
- by justjoe
$jj_post is the array output debug via print_r. this variable is an array of object
Array
(
[0] = stdClass Object
(
[ID] = 2571
)
)
i access the object property, ID, via code like this :
$jj_post_id = $jj_post[0];
$jj_ID = $jj_post_id-ID;
so, is there a better way, cause this is the only thing i know and i feel the code little bit too long ?