Some elements in my array are empty strings based on what the user has submitted. I need to remove those elements. I have this:
foreach($linksArray as $link)
As per your method, you can just catch those elements in an another array and use that one like follows,
foreach($linksArray as $link){ if(!empty($link)){ $new_arr[] = $link } } print_r($new_arr);