Quantcast
Channel: Remove empty array elements - Stack Overflow
Viewing all articles
Browse latest Browse all 28

Answer by mulquin for Remove empty array elements

$
0
0

If you are working with a numerical array and need to re-index the array after removing empty elements, use the array_values function:

array_values(array_filter($array));

Also see: PHP reindex array?


Viewing all articles
Browse latest Browse all 28

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>