PHP trim() 函数定义和用法trim() 函数从字符串的两端删除空白字符和其他预定义字符。 语法trim(string,charlist)
例子例子 1<html>
<body>
<?php
$str = " Hello World! ";
echo "Without trim: " . $str;
echo "<br />";
echo "With trim: " .
输出: Without trim: Hello World! With trim: Hello World! HTML 源码: <html> <body> Without trim: Hello World! <br />With trim: Hello World! </body> </html> 例子 2<?php
$str = "\r\nHello World!\r\n";
echo "Without trim: " . $str;
echo "<br />";
echo "With trim: " .
输出: Without trim: Hello World! With trim: Hello World! HTML 源码: <html> <body> Without trim: Hello World! <br />With trim: Hello World! </body> </html> |
|