3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = ['a' => '123', 'b' => '321', 'c' => ['asdf' => 'asdf']]; $b = ['a' => '123', 'b' => '123', 'c' => ['asdf' => 'asdf123']]; $r = array_udiff_assoc($a, $b, function($old, $new) { if ($old === $new) { return 0; } return (count($old) > $new ? 1 : -1); }); var_dump($r);
based on pvVLt
Output for 7.2.0
Warning: count(): Parameter must be an array or an object that implements Countable in /in/S99Up on line 9 array(2) { ["b"]=> string(3) "321" ["c"]=> array(1) { ["asdf"]=> string(4) "asdf" } }
Output for 5.4.0 - 7.1.10
array(2) { ["b"]=> string(3) "321" ["c"]=> array(1) { ["asdf"]=> string(4) "asdf" } }
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/S99Up on line 3
Process exited with code 255.