dimanche 5 avril 2015

How to unset an array by null key in php

Before:



$my_array = Array ( [TRUE] => 1 [FALSE] => 2 [] => 0 )


I wanna remove the array if the key[] is null.


My concept :



if ($my_array.key is null) {
unset($my_array.key)
}


Hope the array becomes:



$my_array = Array ( [TRUE] => 1 [FALSE] => 2)

Aucun commentaire:

Enregistrer un commentaire