Answer the question
In order to leave comments, you need to log in
How to get that email where email is equal to [email protected]?
<?php
$json = 'id1 = {
"name":"Karen",
"email":[email protected],
"password":123456
"activation":0,
},
id2 = {
"name":"Anush",
"email":[email protected],
"password":654321
"activation":0,
},
id3 = {
"name":"Vahe",
"email":[email protected],
"password":vahe1992
"activation":0,
}
}';
?>
Answer the question
In order to leave comments, you need to log in
$data = json_decode($json);
$found = false;
foreach($data as $person) {
if( $person->email === '[email protected]') {
$found = $person;
break;
}
}
if( $found) {
// нашёлся! – он в переменной $found
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question