PHP ltrim() 函数
实例
移除字符串左侧的字符:
<"Hello World!"; echo $str . "<br>"; echo ltrim($str,"Hello"); "htmlcode">ltrim( _string,charlist_ )实例 1
移除字符串左侧的空格:
<" Hello World!"; echo "Without ltrim: " . $str; echo "<br>"; echo "With ltrim: " . ltrim($str); "htmlcode"><!DOCTYPE html> <html> <body> Without ltrim: Hello World!<br>With ltrim: Hello World! </body> </html>上面代码的浏览器输出如下:
Without ltrim: Hello World!
With ltrim: Hello World!实例 2
移除字符串左侧的换行符(\n):
<"nnnHello World!"; echo "Without ltrim: " . $str; echo "<br>"; echo "With ltrim: " . ltrim($str); "htmlcode"><!DOCTYPE html> <html> <body> Without ltrim: Hello World!<br>With ltrim: Hello World! </body> </html>上面代码的浏览器输出如下:
Without ltrim: Hello World!
With ltrim: Hello World!总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对的支持。如果你想了解更多相关内容请查看下面相关链接