0
Talk personal, all right? I have this code, I would like to know how I can print the values, only one below the other and each one inside a respective box.
<?php
$a= [1,4,6,9,10,12];
$b= [2,4,9,12];
$iguais = [];
$diferentes = [];
foreach($a as $item){
$i = array_search($item, $b);
if($i !== false){
$iguais[] = '('. $item .', '. $b[$i] .')';
unset($b[$i]);
}else{
$diferentes[] = $item;
}
}
$d = [$b];
$e = [$diferentes];
$common = array_intersect( $diferentes, $b,$a);
$diff2 = array_diff( $b, $common );
$diff3 = array_diff( $diferentes, $common );
$diferentes += $b;
echo "IGUAIS - ";
print_r($iguais);
echo "FALTA PERNA EM CREDITO - ";
print_r($diff3);
echo "SOMA(a) = ".array_sum($diff3)."\n";
echo "FALTA PERNA EM DEBITO - ";
print_r($diff2);
echo "SOMA(a) = ".array_sum($diff2)."\n";
?>
Thank you for your attention.
Which box? tried to use
<br>
? could add source code– rray
When printing the values, they are next to each other with the EX array count: MISSING CREDIT LEG - Array ( [0] => 195936 [1] => 8785 [2] => 94438 [3] => 351 .
– Gustavo Freire
Remove the
print_r
and do a foreach or form just a test and want to format the outputecho '<pre>';
.– rray