tags:

views:

18

answers:

4

Hi, say I have a string like so

 Testing       

How could I have it remove all spaces before the first letter, and all spaces after the last letter in the string.

Thanks!

+1  A: 

use trim()

Be sure to have this close by: String functions in PHP

Pekka
A: 

Try the trim function.

Ben Torell
A: 
string trim  (  string $str  [,  string $charlist  ] )
MJB
+1  A: 

Look here for all string functions in PHP.

http://php.net/manual/en/ref.strings.php

use trim(string)

Aaron