<?php
$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 2, 'cyan' => 1);
$arr=array();
foreach($array1 as $value){
if (!in_array($value, $array2)) {
$arr[]=$value;
}
}
print_r($arr);
?>
Array ( [0] => 3 [1] => 4 )
No hay comentarios:
Publicar un comentario