Removing a space from between digits
Posted: Thu Nov 14, 2002 8:47 am
This I thought would be simple but I can't seem to find a way of removing a space from between two numbers, it is actually a phone number with any prefix needed before the number which will be seperated by a space, take $phone = "456 56789"; I just need to know if the variable contains digits and or digits and spaces.
I thought that I could replace the " " with "" using the strtr function then use is_numeric but the strtr function does not seem to work with spaces, I thought there might be a function like trim that would remove all the spaces but there does not seem to be one in the manual, isn't there any simple way of doing this?
I thought that I could replace the " " with "" using the strtr function then use is_numeric but the strtr function does not seem to work with spaces, I thought there might be a function like trim that would remove all the spaces but there does not seem to be one in the manual, isn't there any simple way of doing this?