Remove empty array elements

前端 未结 27 3865
半阙折子戏
半阙折子戏 2020-11-21 23:17

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)         


        
27条回答
  •  后悔当初
    2020-11-21 23:42

    I use the following script to remove empty elements from an array

    for ($i=0; $i<$count($Array); $i++)
      {
        if (empty($Array[$i])) unset($Array[$i]);
      }
    

提交回复
热议问题