<html lang="ko">
<head>
<meta charset="UTF-8">
<title>PHP Built In Function</title>
</head>
<body>
$str = "hello, beautiful, world!";
$array = explode(',', $str); // ','를 기준으로 문자열을 나눔.
echo $array[0]."<br>"; // hello
echo $array[1]."<br>"; // beautiful
echo $array[2]."<br><br>"; // world!
$str2 = implode('!', $array); // '!'를 기준으로 문자열을 결합함.
echo $str2."<br><br>"; // hello! world!
$token = strtok($str2, '!'); // '!'를 기준으로 토큰화
echo $token."<br>"; // hello
while($token != ""){ // 문자열이 끝날 때까지
$token = strtok('!'); // '!'를 기준으로 토근화하고 출력함.
echo $token."<br>"; // beautiful, world
}
</body>
</html>