Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

use external variable in php function

//Make a new array $arr3 from $arr1 where keys of $arr1 is not in keys of $arr2
$arr = ['a' => 1, 'b' => 2, 'c' => 3];
$arr2 = ['a' => 5, 'b' => 6];

$arr3 = array_filter($arr, function ($k) use ($arr2) {
  return !in_array($k, array_keys($arr2));
}, ARRAY_FILTER_USE_KEY);
 
PREVIOUS NEXT
Tagged: #external #variable #php #function
ADD COMMENT
Topic
Name
1+4 =