3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array(object1,object2,object3); $attributes example array('first_name'=>'value','last_name'=>'value'); function filter_by_key($array, $attributes) { $filtered = array(); foreach($array as $k => $v) { //if($v->$member != $value) //stuck here $filtered[$k] = $v; } return $filtered; } var_dump(filter_by_key($array, $attributes));
Output for 5.4.0 - 5.4.21, 5.5.0 - 5.5.5
Parse error: syntax error, unexpected 'example' (T_STRING) in /in/9tt2Y on line 3
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_STRING in /in/9tt2Y on line 3
Process exited with code 255.

preferences:
185 ms | 1395 KiB | 63 Q