开发者

Remove Multiple Spaces Before and After Characters PHP

开发者 https://www.devze.com 2022-12-25 19:30 出处:网络
say I have a string like so Testing How could I have it remove all sp开发者_开发知识库aces before the first letter, and all spaces after the last letter in the string.

say I have a string like so

 Testing       

How could I have it remove all sp开发者_开发知识库aces before the first letter, and all spaces after the last letter in the string.

Thanks!


Look here for all string functions in PHP.

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

use trim(string)


use trim()

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


Try the trim function.


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

精彩评论

暂无评论...
验证码 换一张
取 消