3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // result from db $recordset1 = [ [ 'id' => 1337, 'name' => 'Foo', 'age' => '40', 'sex' => 'yes please', ], [ 'id' => 1347, 'name' => 'Foo', 'age' => '40', 'sex' => 'yes please', ], ]; // this I want $recordset = [ 1337 => [ 'name' => 'Foo', 'age' => '40', 'sex' => 'yes please', ], 1347 => [ 'name' => 'Foo', 'age' => '40', 'sex' => 'yes please', ], ]; $result = array_diff_key(array('id'=>1), ...$recordset1); var_dump($result);
Output for 5.6.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(0) { }
Output for 5.4.0 - 5.5.38
Parse error: syntax error, unexpected '.' in /in/vAM7J on line 33
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/vAM7J on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/vAM7J on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/vAM7J on line 4
Process exited with code 255.