Skip to content

Instantly share code, notes, and snippets.

@ichadhr
Last active October 14, 2019 08:18
Show Gist options
  • Save ichadhr/6c7d270e1fc64df2d512cdc4ee9d9415 to your computer and use it in GitHub Desktop.
Save ichadhr/6c7d270e1fc64df2d512cdc4ee9d9415 to your computer and use it in GitHub Desktop.
function in_array_r($needle, $haystack, $strict = false) {
foreach ($haystack as $item) {
if (($strict ? $item === $needle : $item == $needle) || (is_array($item) && in_array_r($needle, $item, $strict))) {
return true;
}
}
return false;
}
// sample
foreach ($array as $k => $v) {
$val = $v['num_invoice'];
if(!in_array_r($val, $array2))
{
// return true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment