<?php
echo "<hr>";
echo "<br>";
$json = '{
"Id" : {
"Name" : "Karen",
"email" : "karenshahmuradyan@gmail.com",
"password" : "123456"
},
"ID2" : {
"Name" : "Anush",
"email" : "duduk1992@mail.ru",
"password" : "1992120"
}
}';
<?php
echo "<hr>";
echo "<br>";
$json = '{
"Id" : {
"Name" : "Karen",
"email" : "karenshahmuradyan@gmail.com",
"password" : "123456"
},
"ID2" : {
"Name" : "Anush",
"email" : "duduk1992@mail.ru",
"password" : "1992120"
}
}';
$decoded = json_decode($json);
$expectedValue;
foreach($decoded as $key=>$value) {
if($value->email=='duduk1992@mail.ru') {
$expectedValue = $key;
}
}
var_dump($expectedValue);