I am printing out the values using print_r($_POST["prod_sizes"]);
print_r($_POST["prod_sizes"]);
So i get output like this => dsf,,thisnajndk,faklsf,klam,flkamlkd,mklmd,l,,adad
After that i use this code:
$sizes = strip_tags(preg_replace('/[^a-z0-9,]/i', '', $_POST["prod_sizes"]));
$var = explode(',', $sizes);
print_r($var);
I get output like
Array
(
[0] => dsf
[1] =>
[2] => thisnajndk
[3] => faklsf
[4] => klam
[5] => flkamlkd
[6] => mklmd
[7] => l
[8] =>
[9] => adad
)
As from the above output we can see that there are some blank values in an array. How to remove those blank values?