Код: Выделить всё
$this_will_be_saved = json_encode($array);
Код: Выделить всё
$this_will_be_saved = json_decode($this_will_be_saved, true);
Код: Выделить всё
array(5) {
[0]=>
array(2) {
["rating"]=>
int(9)
["userid"]=>
int(1)
}
[1]=>
array(2) {
["rating"]=>
int(9)
["userid"]=>
int(1)
}
[2]=>
array(2) {
["rating"]=>
int(9)
["userid"]=>
int(1)
}
[3]=>
array(2) {
["rating"]=>
int(1)
["userid"]=>
int(1)
}
[4]=>
array(2) {
["rating"]=>
int(7)
["userid"]=>
int(1)
}
}
Код: Выделить всё
$key = array_search($userid, array_column($this_will_be_saved, 'userid'));
if ( $key ) {
// found
} else {
// not found
}
Подробнее здесь: https://stackoverflow.com/questions/478 ... a-2d-array