龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > php编程 >

trim php中四个去除字符串中空字符的函数

时间:2014-08-18 11:48来源:网络整理 作者:网络 点击:
分享到:
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!)
精彩图集

赞助商链接