Mega Code Archive

 
Categories / Php / Strings
 

Strtok() function tokenizes string, using the characters specified in tokens

Its syntax is: string strtok (string string, string tokens) <? $info = "WJ asdf asdf sdf"; // delimiters include colon (:), vertical bar (|), and comma (,) $tokens = ":|,"; $tokenized = strtok($info, $tokens); while ($tokenized) :      echo "Element = $tokenized<br>";      $tokenized = strtok ($tokens); endwhile; ?>