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