Dividing a String into Tokens with strtok()
<?php
<html>
<head>
<title>Dividing a string into tokens with strtok()</title>
</head>
<body>
<div>
<?php
$test = "php?id=353&sec=44&user=harry&context=php";
$delims = "?&";
$word = strtok( $test, $delims );
while ( is_string( $word ) ) {
if ( $word ) {
print "$word<br/>";
}
$word = strtok( $delims );
}
?>
</div>
</body>
</html>
Related examples in the same category