lundi 19 octobre 2020

skip key and its value if key is empty in laravel

I am trying to skip key and it's value if empty.
Following example key f is empty and I want to remove that.


$array1 = array("a"=>1, "b"=>2, "c"=>3, "d"=>4, "e"=>5,"f"=>"","i"=>0);

Expected array in laravel

array
      'a' => int 1
      'b' => int 2
      'c' => int 3
      'd' => int 4
      'e' => int 5
      'i' => int 0

I have tried many way like taking if conditions, and array_filter but still not worked



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2ILbcAL
via IFTTT

Aucun commentaire:

Enregistrer un commentaire