update : 2015.11.03
php.shukuma.com검색:
|
trim(PHP 4, PHP 5) trim — Strip whitespace (or other characters) from the beginning and end of a string 설명
string trim
( string
$str
[, string $character_mask = " \t\n\r\0\x0B"
] )
This function returns a string with whitespace stripped from the
beginning and end of
인수
반환값The trimmed string. 예제
Example #1 Usage example of trim()
<?php 위 예제의 출력: string(32) " These are a few words :) ... " string(16) " Example string " string(11) "Hello World" string(28) "These are a few words :) ..." string(24) "These are a few words :)" string(5) "o Wor" string(9) "ello Worl" string(14) "Example string"
Example #2 Trimming array values with trim()
<?php 위 예제의 출력: array(3) { [0]=> string(5) "apple" [1]=> string(7) "banana " [2]=> string(11) " cranberry " } array(3) { [0]=> string(5) "apple" [1]=> string(6) "banana" [2]=> string(9) "cranberry" } 주의
참고
|