0

What function can I use?

pavium
  • 14,808
  • 4
  • 33
  • 50
Steven
  • 24,410
  • 42
  • 108
  • 130
  • trim().Sorry, I just forgot this function. – Steven Dec 12 '09 at 08:30
  • 1
    @Filburt Your [possible duplicate](http://stackoverflow.com/q/122616/1267661) is in C not PHP. I would use trim() like the accepted answer here... – Sam Aug 25 '12 at 23:41

5 Answers5

3

left most

ltrim('text');

right most

rtrim('text');

but shortcut of above two is simply

trim('text');
Sarfraz
  • 377,238
  • 77
  • 533
  • 578
3

Use trim to remove whitespace at the start and end of a string.

Gumbo
  • 643,351
  • 109
  • 780
  • 844
0

string trim ( string $str [, string $charlist ] )

This function returns a string with whitespace stripped from the beginning and end of str

pek
  • 17,847
  • 28
  • 86
  • 99
0

http://php.net/manual/en/function.trim.php would be your best choice

Fifth-Edition
  • 365
  • 3
  • 5
  • 14
0

Checkout PHP Trim.

Shoban
  • 22,920
  • 8
  • 63
  • 107