1--TEST--
2Test strtok() function : basic functionality
3--FILE--
4<?php
5/*
6 * Testing strtok() : basic functionality
7*/
8
9echo "*** Testing strtok() : basic functionality ***\n";
10
11// Initialize all required variables
12$str = 'This testcase test strtok() function.';
13$token = ' ().';
14
15echo "\nThe Input string is:\n\"$str\"\n";
16echo "\nThe token string is:\n\"$token\"\n";
17
18// using strtok() with $str argument
19echo "\n--- Token 1 ---\n";
20var_dump( strtok($str, $token) );
21
22for( $i = 2; $i <=7; $i++ )  {
23  echo "\n--- Token $i ---\n";
24  var_dump( strtok($token) );
25}
26
27echo "Done\n";
28?>
29--EXPECT--
30*** Testing strtok() : basic functionality ***
31
32The Input string is:
33"This testcase test strtok() function."
34
35The token string is:
36" ()."
37
38--- Token 1 ---
39string(4) "This"
40
41--- Token 2 ---
42string(8) "testcase"
43
44--- Token 3 ---
45string(4) "test"
46
47--- Token 4 ---
48string(6) "strtok"
49
50--- Token 5 ---
51string(8) "function"
52
53--- Token 6 ---
54bool(false)
55
56--- Token 7 ---
57bool(false)
58Done
59