<?php $firstArray = array(3,4,5,6); $secondArray = array(4, 5); $outputArray = array(); for($i=0; $i<count($firstArray);$i++) { $found = false; for($j=0; $j<count($secondArray);$j++) { if($firstArray[$i] == $secondArray[$j]) { $found = true; } } if($found == false){ $outputArray[] = $firstArray[$i]; } } print_r($outputArray);
You have javascript disabled. You will not be able to edit any code.