I'm trying to decode API to PHP.
API EXM
{
"users":[
{"user":"john",
"user1":"Tabby",
"user2":"Ruby",
"user3":"Silver"}
]
}
tilte users = 0 (It's empty)
I tried with this code but it's not working (blank page)
<?php
$json = '{ "users"[ {"user":"john", "user1":"Tabby", "user2":"Ruby", "user3":"Silver"}';
$arr = json_decode($json);
echo $arr->users->{0}->user; //blank page
echo $arr->users->user1; //blank page
echo $arr->users->0->user2; //syntax error, unexpected '0' (T_LNUMBER), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in
?>