3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function arrayReplace($a1, $a2) { foreach($a2 as $k=>$v) { $a1[$k]=$v; } return $a1; } function arrayDiffFull() { $numArrays=func_num_args(); $totalA=array(); $returnA=array(); $arg_list = func_get_args(); foreach($arg_list as $i=>$eachArray) { foreach($eachArray as $k=>$value) { $totalA[$k][$i]=strtolower($value); } } foreach($totalA as $k=>$eachKArray) { if ( count($eachKArray)!=$numArrays || count(array_unique($eachKArray))!=1 ) { $returnA[$k]=arrayReplace( array_fill(0,$numArrays,''), $eachKArray ); } } return $returnA; } $a1 = array(0 => 1, 1 => "b", 3 => "carrot"); $a2 = array(1 => "c", 2 => "d", 3 => "apple"); print_r(arrayDiffFull($a1, $a2));
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => Array ( [0] => 1 [1] => ) [1] => Array ( [0] => b [1] => c ) [3] => Array ( [0] => carrot [1] => apple ) [2] => Array ( [0] => [1] => d ) )