array_filter没有带有false值的strip键

I've this array:

[
  'a' => true,
  'b' => false,
  'c' = null,
  'd' = 'foo'
]

I need to strip from it only the null keys and keep all the rest.

[
  'a' => true,
  'b' => false,
  'd' = 'foo'
]

I've tried with array_filter but it strips even the false keys, how can I do?

Provide an explicit callback to test for null

$array = array_filter(
    $array,
    function ($value) {
        return $value !== null;
    }
);
$filtered = array_filter($array, function ($value) { return $value !== null; });

use callback function of array filter

<?php
function stripnull($var)
{
    // returns whether the input integer is odd
    return $var !== null;
}


$array1 = array("a"=>true, "b"=>false, "c"=>null);