import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-strings / strtok_variation4.php
blobb62a990e84d9d06567713e5df01048643c8a2806
1 <?php
2 /* Prototype : string strtok ( str $str, str $token )
3 * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token
4 * Source code: ext/standard/string.c
5 */
7 /*
8 * Testing strtok() : with embedded nulls in the strings
9 */
11 echo "*** Testing strtok() : with embedded nulls in the strings ***\n";
13 // defining varous strings with embedded nulls
14 $strings_with_nulls = array(
15 "\0",
16 '\0',
17 "hello\0world",
18 "\0hel\0lo",
19 "hello\0",
20 "\0\0hello\tworld\0\0",
21 "\\0he\0llo\\0",
22 'hello\0\0'
25 // loop through each element of the array and check the working of strtok()
26 // when supplied with different string values
28 $counter = 1;
29 foreach( $strings_with_nulls as $string ) {
30 echo "\n--- Iteration $counter ---\n";
31 var_dump( strtok($string, "\0") );
32 for($count = 1; $count <= 5; $count++) {
33 var_dump( strtok("\0") );
35 $counter++;
39 echo "Done\n";