1--TEST-- 2Test 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 16echo "*** 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 26var_dump( strspn($str, $mask, $start, $len) ); 27 28// Calling strspn() with three arguments and default len argument 29var_dump( strspn($str, $mask, $start) ); 30 31// Calling strspn() with default arguments 32var_dump( strspn($str, $mask) ); 33 34echo "Done" 35?> 36--EXPECTF-- 37*** Testing strspn() : basic functionality *** 38int(11) 39int(11) 40int(2) 41Done 42