trim — Strip whitespace (or other characters) from the beginning…
페이지 정보
작성자 LYJ 작성일10-01-19 14:16 조회15,800회 댓글1건관련링크
본문
string trim ( string $str [, string $charlist ] )
Example #1 Trimming array values with trim()
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.
댓글목록
LYJ님의 댓글
LYJ 작성일
if(!$auth[admin]) {
$rg_name = ereg_replace( ' +', '', $rg_name );
$rg_name=substr($rg_name,0,4)."○";
}