3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( array('id' => 4, 'name' => 'test', 'surname' => 'test1'), array('id' => 6, 'name' => 'test4', 'surname' => 'test5') ); $id = 4; $out = array(); foreach($arr as $val){ if($val['id'] == $id){ $out = $val; break; } } echo '<pre>'; print_r($out);

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
147.1 ms | 2305 KiB | 11 Q