How to use strtok in PHP
In this article I will explain how strtok function used in PHP.
strtok() Function
This function splits a string into smaller strings.
Syntax
Parameter |
Description |
string |
Required. Specifies the string to split |
split |
Required. Specifies one or more split characters |
Example
<html>
<body>
<?php
$string = "Hello Satya. Today is Sunday.";
$token = strtok($string, " ");
while ($token != false)
{
echo "$token<br />";
$token = strtok(" ");
} ?>
</body>
</html> |
Output
You may also want to read these related articles Click here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here