string of the first array $arr_prim[]
should be null when it looks similar to the second $arr_sec[]
,
<?php
$arr_prim[] = array('2','3');
//array primaria
$arr_sec[] = array('1','2','3');
//array secundaria
foreach($arr_prim as & $key):
var_dump($key);
endforeach;
foreach($arr_sec as & $res):
var_dump($res);
endforeach;
?>
/*Ambos irá imprimir
array (size=3)
0 => string '1' (length=1)
1 => string '2' (length=1)
2 => string '3' (length=1)
*/
foreach($arr_prim as $k => $value){
if($s = array_search($value, $arr_sec)){
$arr_sec[$k] = null;
var_dump($arr_sec);
/*resultado da impressão:
array (size=3)
0 => null
1 => string '2' (length=1)
2 => string '3' (length=1)
*/
}
}