trim — Strip whitespace (or other characters) from the beginning and end of a string |
|
|
 |
14³â Àü |
string trim ( string $str [, string $charlist ] )
Example #1 Trimming array values with trim()
<?php
function trim_value(&$value)
{
$value = trim($value);
}
$fruit = array('apple','banana ', ' cranberry ');
var_dump($fruit);
array_walk($fruit, 'trim_value');
var_dump($fruit);
?>
Example #2
<?php
$string = 'This string has no whitespaces.';
echo ereg_replace( ' +', '', $string );
?>
Output: Thisstringhasnowhitespaces.
http://docs.php.net/manual/kr/function.trim.php
=====================
if(!$auth[admin]) {
$rg_name = ereg_replace( ' +', '', $rg_name );
$rg_name=substr($rg_name,0,4)."¡Û";
} |
|
̵̧ : 326 |
̵̧
¸ñ·Ï
|
|