In PHP i have this string variable:
$var = " 00480722 ZF452D041502 13 9900 153370178";
When I do explode, i get something like this:
$var = explode(" ",$var);
echo count($var);
// prints -> 36
so this explode makes an array of 36 elements, most of which are "". How do I shrink all of those multiple spaces in between the data so I can do explode and just get :
$var[0] -> 00480722
$var[1] -> ZF452D041502
...
$var[4] -> 153370178
You could use a regular expression split:
This will split on any number of sequential space characters. The
trimis used to prevent empty matches at the beginning and/or end of the input string.