Remove empty array elements

前端 未结 27 3488
半阙折子戏
半阙折子戏 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-22 00:07

        $myarray = array_filter($myarray, 'strlen');  //removes null values but leaves "0"
        $myarray = array_filter($myarray);            //removes all null values
    

提交回复
热议问题