3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = [ 'foo' => [1], 'bar' => 5, ]; $b = [ 'foo' => [1], 'bar' => 6, ]; $i = array_diff($a, $b); var_dump($i);
based on 9HYkT
Output for 7.0.0 - 7.2.0
Notice: Array to string conversion in /in/1NJLg on line 12 Notice: Array to string conversion in /in/1NJLg on line 12 array(1) { ["bar"]=> int(5) }
Output for 5.4.11 - 5.6.28
Notice: Array to string conversion in /in/1NJLg on line 12 Notice: Array to string conversion in /in/1NJLg on line 12 Notice: Array to string conversion in /in/1NJLg on line 12 Notice: Array to string conversion in /in/1NJLg on line 12 Notice: Array to string conversion in /in/1NJLg on line 12 Notice: Array to string conversion in /in/1NJLg on line 12 array(1) { ["bar"]=> int(5) }
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/1NJLg on line 3
Process exited with code 255.