import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-strings / strspn_variation9.php
blob11e1cce639391352218e7e6fa6d86b923ce3c333
1 <?php
2 /* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
3 * Description: Finds length of initial segment consisting entirely of characters found in mask.
4 If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
5 * Source code: ext/standard/string.c
6 * Alias to functions: none
7 */
9 /*
10 * Testing strspn() : with different strings as str argument and default start and len args
13 echo "*** Testing strspn() : with different str and default start and len args ***\n";
15 // initialing required variables
16 // defining different strings
18 $strings = array(
19 "",
20 '',
21 "\n",
22 '\n',
23 "hello\tworld\nhello\nworld\n",
24 'hello\tworld\nhello\nworld\n',
25 "1234hello45world\t123",
26 '1234hello45world\t123',
27 "hello\0world\012",
28 'hello\0world\012',
29 chr(0).chr(0),
30 chr(0)."hello\0world".chr(0),
31 chr(0).'hello\0world'.chr(0),
32 "hello".chr(0)."world",
33 'hello'.chr(0).'world',
34 "hello\0\100\xaaaworld",
35 'hello\0\100\xaaaworld'
38 $mask = "sfth12\ne34lw56r78d90\0\xaa\100o";
41 // loop through each element of the array for str argument
43 foreach($strings as $str) {
44 echo "\n-- Iteration with str value \"$str\" --\n";
46 //calling strspn() with default arguments
47 var_dump( strspn($str,$mask) );
50 echo "Done"