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
9 error_reporting(E_ALL
& ~E_NOTICE
);
12 * Testing strspn() : with unexpected values of start argument
15 echo "*** Testing strspn() : with unexpected values of start argument ***\n";
17 // initialing required variables
19 $mask = 'soibtFTf1234567890';
22 //get an unset variable
28 public function __toString() {
33 // creating a file resource
34 $file_handle = fopen(__FILE__
, 'r');
37 //array of values to iterate over
52 array('color' => 'red', 'item' => 'pen'),
85 // loop through each element of the array for start
87 foreach($values as $value) {
88 echo "\n-- Iteration with start value as \"$value\" --\n";
89 var_dump( strspn($str,$mask,$value) ); // with default len value
90 var_dump( strspn($str,$mask,$value,$len) ); // with all args
93 // closing the resource