세상이야기

PHP 문자열 분리함수 explode / split

쿠카곰돌이 2015. 11. 24. 02:06
반응형

array split ( string $pattern , string $string [, int $limit = -1 ] )
array preg_split(string $pattern,string $subject [,int $limit = -1 [, int $flags = 0 ]] )
array explode ( string $delimiter , string $string [, int $limit ] )

사용 예제

function fn_modiData3()

{

<?

$pieces = explode("/", $profile[kor_nm]);

$liKor = $pieces[0];

$liEng = $pieces[1];

$liLoc = $pieces[2];


$liKor = ltrim($liKor," ");

$liKor = rtrim($liKor," ");


$liEng = ltrim($liEng," ");

$liEng = rtrim($liEng," ");


$liLoc = ltrim($liLoc," ");

$liLoc = rtrim($liLoc," ");


?>

  document.main.kor_nm.value         = "<?=$liKor?>" ;

  document.main.eng_nm.value         = "<?=$liEng?>" ;

  document.main.local_nm.value       = "<?=$liLoc?>" ;

}

</script>



반응형