0

What function can I use?

pavium
  • 14,290
  • 4
  • 30
  • 46
Steven
  • 23,118
  • 41
  • 104
  • 129
  • 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
  • 367,681
  • 72
  • 526
  • 573
3

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

Gumbo
  • 620,600
  • 104
  • 758
  • 828
0

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

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

pek
  • 17,359
  • 27
  • 84
  • 99
0

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

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

Checkout PHP Trim.

Shoban
  • 22,815
  • 8
  • 62
  • 106