$word="01 2 3 4 5 6 7 8 9 0';
I have a variable like the above.
and I like to remove all spaces between the numbers but leave 1 space between numbers if each has any space.
The following is the code I tried, but failed
$word = str_replace( ' ', ' ', $word );
$word = str_replace( ' ', ' ', $word );
$word = str_replace( ' ', ' ', $word );
it is still remained many spaces which is more than one space .
The result below is what I want.
01 2 3 4 5 6 7 8 9 0