Annotation of embedaddon/php/ext/standard/tests/strings/strspn_basic.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test strspn() function : basic functionality
3: --FILE--
4: <?php
5: /* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
6: * Description: Finds length of initial segment consisting entirely of characters found in mask.
7: If start or/and length is provided, it works like strspn(substr($s,$start,$len),$good_chars)
8: * Source code: ext/standard/string.c
9: * Alias to functions: none
10: */
11:
12: /*
13: * Testing strspn() : basic functionality
14: */
15:
16: echo "*** Testing strspn() : basic functionality ***\n";
17:
18:
19: // Initialise all required variables
20: $str = "this is the test string";
21: $mask = "htes ";
22: $start = 8;
23: $len = 30;
24:
25: // Calling strspn() with all possible arguments
26: var_dump( strspn($str, $mask, $start, $len) );
27:
28: // Calling strspn() with three arguments and default len argument
29: var_dump( strspn($str, $mask, $start) );
30:
31: // Calling strspn() with default arguments
32: var_dump( strspn($str, $mask) );
33:
34: echo "Done"
35: ?>
36: --EXPECTF--
37: *** Testing strspn() : basic functionality ***
38: int(11)
39: int(11)
40: int(2)
41: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>