3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = Array ( [rpiid] => Array ( [1] => 86 ), [sensor_id] => Array ( [1] => 1 ), [when] => Array ( [1] => 2014-02-24 ), [val] => Array ( [1] => 000 ), [train] => Array ( [1] => True ), [valid] => Array ( [1] => False ), [button] => update ); foreach($a as $key => $value){ $new_array[$key] = $value[0]; } var_dump($new_array);
Output for 5.4.0 - 5.6.28
Notice: Use of undefined constant rpiid - assumed 'rpiid' in /in/Z3ccN on line 5 Warning: Illegal offset type in /in/Z3ccN on line 8 Warning: Illegal offset type in /in/Z3ccN on line 8 Notice: Use of undefined constant sensor_id - assumed 'sensor_id' in /in/Z3ccN on line 10 Warning: Illegal offset type in /in/Z3ccN on line 13 Warning: Illegal offset type in /in/Z3ccN on line 13 Notice: Use of undefined constant when - assumed 'when' in /in/Z3ccN on line 15 Warning: Illegal offset type in /in/Z3ccN on line 18 Warning: Illegal offset type in /in/Z3ccN on line 18 Notice: Use of undefined constant val - assumed 'val' in /in/Z3ccN on line 20 Warning: Illegal offset type in /in/Z3ccN on line 23 Warning: Illegal offset type in /in/Z3ccN on line 23 Notice: Use of undefined constant train - assumed 'train' in /in/Z3ccN on line 25 Warning: Illegal offset type in /in/Z3ccN on line 28 Warning: Illegal offset type in /in/Z3ccN on line 28 Notice: Use of undefined constant valid - assumed 'valid' in /in/Z3ccN on line 30 Warning: Illegal offset type in /in/Z3ccN on line 33 Warning: Illegal offset type in /in/Z3ccN on line 33 Notice: Use of undefined constant button - assumed 'button' in /in/Z3ccN on line 35 Notice: Use of undefined constant update - assumed 'update' in /in/Z3ccN on line 36 Warning: Illegal offset type in /in/Z3ccN on line 36 Notice: Undefined variable: new_array in /in/Z3ccN on line 40 NULL
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.28
Parse error: syntax error, unexpected '[', expecting ')' in /in/Z3ccN on line 5
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 '[', expecting ')' in /in/Z3ccN on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/Z3ccN on line 5
Process exited with code 255.