If have an array like this:
array
0 => string '62 52, 53' (length=9)
1 => string '54' (length=2)
It's from user input, and you never know how/what they enter ;)
What I want in the end is this:
array
0 => string '62' (length=2)
1 => string '52' (length=2)
2 => string '53' (length=2)
3 => string '54' (length=2)
Here's how I do it:
$string = implode(',', $array);
$string = str_replace(', ', ',', $string);
$string = str_replace(' ', ',', $string);
$array = explode(',', $string);
Seems really clunky. Is there a more elegant way? One that maybe has better performance?