Some elements in my array are empty based on what the user has entered. I need to remove these elements. This is my code to do so:
// Remove empty elements
foreach($linksArray as $link)
{
if($links == '')
{
unset($link);
}
}
print_r($linksArray);
But it doesn't work, $linksArray
still has empty elements. I have also tried doing it with the empty()
function but the outcome is the same.
Any help is appreciated, thanks.