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 ArrayFilters($array1), 'name_is')));
Output for 5.3.28 - 5.3.29, 5.4.20 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
Notice: Undefined index: name in /in/RVnK9 on line 10 Notice: Undefined index: name in /in/RVnK9 on line 10 Notice: Undefined index: name in /in/RVnK9 on line 10 Notice: Undefined index: name in /in/RVnK9 on line 10 Notice: Undefined index: name in /in/RVnK9 on line 10 Array ( )
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.19
Notice: Undefined index: name in /in/ASKs1 on line 10 Notice: Undefined index: name in /in/ASKs1 on line 10 Notice: Undefined index: name in /in/ASKs1 on line 10 Notice: Undefined index: name in /in/ASKs1 on line 10 Notice: Undefined index: name in /in/ASKs1 on line 10 Array ( )
Output for 5.0.0 - 5.2.17
Notice: Undefined index: name in /in/ASKs1 on line 10 Notice: Undefined index: name in /in/ASKs1 on line 10 Notice: Undefined index: name in /in/ASKs1 on line 10 Notice: Undefined index: name in /in/ASKs1 on line 10 Notice: Undefined index: name in /in/ASKs1 on line 10 Array ( )
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/ASKs1 on line 3
Process exited with code 255.
Output for 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/ASKs1 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/ASKs1 on line 3
Process exited with code 255.
Output for 4.3.0
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/RVnK9 on line 3
Process exited with code 255.