Annotation of embedaddon/php/ext/standard/tests/strings/strcspn_basic.phpt, revision 1.1.1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>