-1

To be clear, i want this:

Europe    Qualicitaions

to transform to this:

Europe Qualifications

I getting data from xml feed, and some strings like this up has more than one space, problem is that i don't know how many spaces will be in string, so i want to remove all spaces before, and after string, also remove separator spaces from middle more than one, i want to have one space in middle, but no 2,3-10...

user1814358
  • 619
  • 3
  • 8
  • 17

1 Answers1

1
$newstring = preg_replace('/(\s+)/', ' ', $str);
splash58
  • 26,043
  • 3
  • 22
  • 34