i have a JSON with this data:
$data = "meta_data":[
{
"id":2279,
"key":"codice_fiscale",
"value":"gege"
},
{
"id":2280,
"key":"numero_tessera_titolare",
"value":"gre"
},
{
"id":2281,
"key":"classe_tessera_titolare",
"value":"gre"
},
{
"id":2282,
"key":"tratta_da",
"value":"gre"
},
{
"id":2283,
"key":"tratta_a",
"value":"grge"
},
{
"id":2284,
"key":"studente",
"value":"studente"
}];
I need to loop all "key" and when i find the key that i need (in this case "studente") i need to get the value stored in "value".
How can i do this in PHP?
EDIT
I tried this:
foreach($data as $row){
if($row->key=='studente'){
$var = $row->value;
}
}