I was wondering how can I remove all empty values when I explode a string using PHP for example, lets say a user enters ",jay,john,,,bill,glenn,,,"
?
Thanks in advance for the help.
Here is part of the code that explodes user submitted values.
$tags = explode(",", $_POST['tag']);
Simply try:
Adding space after comma, does the job!
E.g. via array_filter() or by using the PREG_SPLIT_NO_EMPTY option on preg_split()
prints