0

Is there a PHP function to detect and remove space type?

Example:

1 2 3 4 5 C i t y n a m e

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Patrik777
  • 11
  • 3

1 Answers1

0

Space as in ' '? Are you looking for ' 'hello this' ' and getting rid of trailing spaces? or do you want to have for example ' 'hello this' ' turn to hellothis?

If so, str_replace(' ', '', $string)

bedtime21
  • 199
  • 8
  • the example shows postcode and cityname. What i'm trying to do is to separate the postcode from cityname and to get rid from spaces of each of them. From 1 2 3 4 5 C i t y n a m e to 12345 Cityname. – Patrik777 Jan 05 '17 at 09:27