3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class ArrayFilters { private $array = array(); public function __construct($array){ $this->array = $array; } public function name_is($name){ return $name == $this->array['name']; } $array1 = array( "a"=>array( 'name' => 'vasya' ,'second_name' => 'Vasilev' ), "b"=>array( 'name' => 'vasya2' ,'second_name' => 'Vasilev2' ), "c"=>array( 'name' => 'vasya3' ,'second_name' => 'Vasilev3' ), "d"=>array( 'name' => 'vasya4' ,'second_name' => 'Vasilev4' ), "e"=>array( 'name' => 'vasya5' ,'second_name' => 'Vasilev5' ) ); } print_r(array_filter($array1, array(new ArrayFilter($array1), 'name_is')));
Output for 5.4.0 - 5.4.19
Parse error: syntax error, unexpected '$array1' (T_VARIABLE), expecting function (T_FUNCTION) in /in/JFmFd on line 13
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /in/JFmFd on line 13
Process exited with code 255.