Change the empty values ​​in the table


I want modify null values in an array(). I only want to modify, not to clean them.

$arr = array ( 'a' => '', 'b' => 'Apple', 'C' => 'Banana');

I want modify and obtain this:

array(a => 'N', b => Apple, C => 'Banana');

I try array_walk() and array_filter(). But empty values are removed.

And I obtain :

array('b' => 'Apple', 'C' => 'Banana');

array_walk($arr, function(&$val)
    if($val == null)
        $val = 'N';

This code works perfectly fine on my machine.