--TEST-- Test strspn() function : usage variations - unexpected values of len argument --FILE-- 'red', 'item' => 'pen'), // null data NULL, null, // boolean data true, false, TRUE, FALSE, // empty data "", '', // string data "string", 'string', // object data new sample(), // undefined data $undefined_var, // unset data $unset_var, // resource $file_handle ); // loop through each element of the array for start foreach($values as $value) { echo "\n-- Iteration with len value as \"$value\" --\n"; var_dump( strspn($str,$mask,$start,$value) ); // with all args }; // closing the resource fclose($file_handle); echo "Done" ?> --EXPECTF-- *** Testing strspn() : with unexpected values of len argument *** -- Iteration with len value as "10.5" -- int(2) -- Iteration with len value as "-10.5" -- int(0) -- Iteration with len value as "1012345670" -- int(2) -- Iteration with len value as "1.07654321E-7" -- int(0) -- Iteration with len value as "0.5" -- int(0) -- Iteration with len value as "Array" -- Warning: strspn() expects parameter 4 to be long, array given in %s on line %d NULL -- Iteration with len value as "Array" -- Warning: strspn() expects parameter 4 to be long, array given in %s on line %d NULL -- Iteration with len value as "Array" -- Warning: strspn() expects parameter 4 to be long, array given in %s on line %d NULL -- Iteration with len value as "Array" -- Warning: strspn() expects parameter 4 to be long, array given in %s on line %d NULL -- Iteration with len value as "Array" -- Warning: strspn() expects parameter 4 to be long, array given in %s on line %d NULL -- Iteration with len value as "" -- int(0) -- Iteration with len value as "" -- int(0) -- Iteration with len value as "1" -- int(1) -- Iteration with len value as "" -- int(0) -- Iteration with len value as "1" -- int(1) -- Iteration with len value as "" -- int(0) -- Iteration with len value as "" -- Warning: strspn() expects parameter 4 to be long, string given in %s on line %d NULL -- Iteration with len value as "" -- Warning: strspn() expects parameter 4 to be long, string given in %s on line %d NULL -- Iteration with len value as "string" -- Warning: strspn() expects parameter 4 to be long, string given in %s on line %d NULL -- Iteration with len value as "string" -- Warning: strspn() expects parameter 4 to be long, string given in %s on line %d NULL -- Iteration with len value as "object" -- Warning: strspn() expects parameter 4 to be long, object given in %s on line %d NULL -- Iteration with len value as "" -- int(0) -- Iteration with len value as "" -- int(0) -- Iteration with len value as "Resource id #%d" -- Warning: strspn() expects parameter 4 to be long, resource given in %s on line %d NULL Done