I would like to know if there is a way to avoid empty keys in an Array while using preg_split
.
The problem is that I have an input field in that every input will be split by spaces. In that case there even will be created a new Array key.
So i use:
$search_term = preg_split('/[\s]+/', $search_term);
when I will enter abc
it creates an Array with:
[0] => abc
but when I will enter:
abc ...
it creates an Array like:
[0] => abc
[1] =>
it`s like it will be prepared for the value. But I would like to know if I can unset this key until it gets some value.
Thanks alot.