im trying to remove a key value pair from an array where the value is empty... only problem is the key/value pair location isn't constant... it moves
whats the most efficient way to do this?
solved my own question:
function clean_array($array) { foreach ($array as $index => $value) { if (empty($value)) unset($array[$index]); } $array = array_values($array); return $array; }
Or
$array = array_filter($array);
I think you don't try hard enough before posting questions, you've asked so many, and you keep solving them yourself...