Ok say I am parsing a string by a space using explode(" ", $data); and there are 2 spaces in a row in a particular area, what would it return? Someone please help I am stumped!
e.g.
$a = "abc cde fgh"; $b = explode(" ", $a);
then $b will be $b[0] = "abc", $b[1] = "cde" & $b[2] = "fgh";
but what about TWO spaces in a row? see I am trying to parse by space to grab some data from a string but when I am trying to grab a date from this line which works fine for dates with 2 digits but if the date is a single digit it will but a space into a space of an array before the actual date because there are 2 spaces in front of the date. I wanted to do an if statement where if a particular array space was blank to assign variables a different way but its not a space! I also tried to trim the string then explode; it got rid of the extra white space in front of single digit dates but explodes the exact same way with the extra spot in the array with the blank space. Help!
Try it. You'd probably get an answer faster that way.
php <?php $string='This has two spaces.'; print_r(explode(' ',$string)); ?>