trim php中四个去除字符串中空字符的函数
php中四个去除字符串中空字符的函数 [代码片段(12行)] 输出结果
<?php $text = "\t \t outofmemory.cn!\t \t "; $leftTrimmed = ltrim($text); $rightTrimmed = rtrim($text); $bothTrimmed = trim($text); print("leftTrimmed = ($leftTrimmed)\n"); print("rightTrimmed = ($rightTrimmed)\n"); print("bothTrimmed = ($bothTrimmed)\n"); ?>
输出结果
leftTrimmed = (outofmemory.cn! ) rightTrimmed = ( outofmemory.cn!) bothTrimmed = (outofmemory.cn!)
- 上一篇:CVS文件的导入和导出php类代码
- 下一篇:php 字符串之模式匹配
精彩图集
精彩文章