I have this array:

    <?php 
    $array = [
        '0' => ['asset' => 'wadus'],
        '1' => ['asset' => 'wadus2'],
        '2' => ['asset' => ''],
    ];
    ?>

If i var_dump the variable $arry I get this:

    array(3) {
      [0] =>
      array(1) {
        'asset' =>
        string(5) "wadus"
      }
      [1] =>
      array(1) {
        'asset' =>
        string(6) "wadus2"
      }
      [2] =>
      array(1) {
        'asset' =>
        string(0) ""
      }
    }

If I use a foreach to iterate around the arry to discard the empty elements:

    $clean_assets = [];
    
    foreach ($array as $asset) {
      if(!empty($asset['asset'])) {
        $clean_assets[] = $asset['asset'];
      } 
    }

If I var_dump the $clean_assets variable I get this:

    array(2) {
      [0] =>
      string(5) "wadus"
      [1] =>
      string(6) "wadus2"
    }



If I use a closure:

    $clean_assets = array_map(function($asset) {
      if(!empty($asset['asset'])){
        return $asset['asset'];
      }    
    }, $array);


I get this result:

I have this array:

    <?php 
    $array = [
        '0' => ['asset' => 'wadus'],
        '1' => ['asset' => 'wadus2'],
        '2' => ['asset' => ''],
    ];
    ?>

If i var_dump the variable $arry I get this:

    array(3) {
      [0] =>
      array(1) {
        'asset' =>
        string(5) "wadus"
      }
      [1] =>
      array(1) {
        'asset' =>
        string(6) "wadus2"
      }
      [2] =>
      array(1) {
        'asset' =>
        string(0) ""
      }
    }

If I use a foreach to iterate around the arry to discard the empty elements:

    $clean_assets = [];
    
    foreach ($array as $asset) {
      if(!empty($asset['asset'])) {
        $clean_assets[] = $asset['asset'];
      } 
    }

If I var_dump the $clean_assets variable I get this:

    array(2) {
      [0] =>
      string(5) "wadus"
      [1] =>
      string(6) "wadus2"
    }



If I use a closure:

    $clean_assets = array_map(function($asset) {
      if(!empty($asset['asset'])){
        return $asset['asset'];
      }    
    }, $array);


I get this result:

    array(3) {
      [0] =>
      string(5) "wadus"
      [1] =>
      string(6) "wadus2"
      [2] =>
      NULL
    }


Any idea way the Empty function doesn't work into the closure?

Thanks.