3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $saved = array( array( 'domain' => 'mydomain.com', 'record' => 'A', 'value' => '8.8.8.8' ), array( 'domain' => 'mydomain.com', 'record' => 'NS', 'value' => 'ns1.mydomain.com' ) ); $new = array( array( 'domain' => 'mydomain.com', 'record' => 'A', 'value' => '4.4.4.4' ), array( 'domain' => 'mydomain.com', 'record' => 'NS', 'value' => 'ns1.mydomain.com' ), array( 'domain' => 'sub.mydomain.com', 'record' => 'A', 'value' => '1.2.3.4' ), ); $combined = array_merge($new,$saved); var_dump(array_udiff($new, $saved, 'cmpr')); function cmpr($a, $b) { foreach($a as $k=>$v) { if ($b[$k] !== $v) return 1; } return 0; }
based on AZLrn
Output for 5.2.6 - 5.2.14, 5.3.0 - 5.3.3, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(2) { [0]=> array(3) { ["domain"]=> string(12) "mydomain.com" ["record"]=> string(1) "A" ["value"]=> string(7) "4.4.4.4" } [2]=> array(3) { ["domain"]=> string(16) "sub.mydomain.com" ["record"]=> string(1) "A" ["value"]=> string(7) "1.2.3.4" } }
Output for 5.0.0 - 5.2.5, 5.2.15 - 5.2.17, 5.3.4 - 5.6.28
array(3) { [0]=> array(3) { ["domain"]=> string(12) "mydomain.com" ["record"]=> string(1) "A" ["value"]=> string(7) "4.4.4.4" } [1]=> array(3) { ["domain"]=> string(12) "mydomain.com" ["record"]=> string(2) "NS" ["value"]=> string(16) "ns1.mydomain.com" } [2]=> array(3) { ["domain"]=> string(16) "sub.mydomain.com" ["record"]=> string(1) "A" ["value"]=> string(7) "1.2.3.4" } }
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: array_udiff() in /in/lHnob on line 16
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: array_udiff() in /in/lHnob on line 16
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: array_udiff() in /in/lHnob on line 16