I cant seem to figure out, or find any information to help me solve what should be a simple problem.. I have some php code, it using curl get request to talk to an api, and the responce im getting from the api is
{"styleHolder":[{"id":100000929,"makeId":200005143,"year":2001,"makeName":"Ford","makeNiceName":"ford","modelId":"Ford_F_150","ect.......
What I need is to take the id, and turn it into a php variable..
I know how to use something like:
$myArray = json_decode($resp);
$id = $myArray->id;
echo $id;
but because the responce has styleHolder as a root property, I cant seem to figure out how to parce out id.. Any help would be great!
styleHolder is an array, so you need to first access the array element, then it's id property.
$myArray = json_decode($resp);
$id = $myArray->styleHolder[0]->id;
echo $id;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With