Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
function foo ($a, $b){
$c = [];
foreach ($a as $val){
if (!in_array($val, $b)){
$c[] = $val;
}
}
return $c;
}
$a = [3, 5, 7];
$b = [4, 5, 9];
$c = foo($a, $b);
var_dump($c);
$a = [3, 5, 7,5];
$b = [4, 5, 9, 0, 0, 2];
var_dump(array_diff($a, $b));