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

1.1       misho       1: --TEST--
                      2: Test strncasecmp() function: usage variations - double quoted strings
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : int strncasecmp ( string $str1, string $str2, int $len );
                      6:  * Description: Binary safe case-insensitive string comparison of the first n characters
                      7:  * Source code: Zend/zend_builtin_functions.c
                      8: */
                      9: 
                     10: /* Test strncasecmp() function with various double quoted strings for 'str1', 'str2' */
                     11: 
                     12: echo "*** Test strncasecmp() function: with double quoted strings ***\n";
                     13: $strings = array(
                     14:   "Hello, World",
                     15:   "hello, world",
                     16:   "HELLO, WORLD",
                     17:   "Hello, World\n",
                     18:   "Hello".chr(0)."World"
                     19: );
                     20: /* loop through to compare each string with the other string */
                     21: $count = 1;
                     22: for($index1 = 0; $index1 < count($strings); $index1++) {
                     23:   echo "-- Iteration $count --\n";
                     24:   for($index2 = 0; $index2 < count($strings); $index2++) {
                     25:     var_dump( strncasecmp( $strings[$index1], $strings[$index2], (strlen($strings[$index1]) + 1) ) );
                     26:   }
                     27:   $count ++;
                     28: }
                     29: echo "*** Done ***\n";
                     30: ?>
                     31: --EXPECTREGEX--
                     32: \*\*\* Test strncasecmp\(\) function: with double quoted strings \*\*\*
                     33: -- Iteration 1 --
                     34: int\(0\)
                     35: int\(0\)
                     36: int\(0\)
                     37: int\(-[1-9][0-9]*\)
                     38: int\([1-9][0-9]*\)
                     39: -- Iteration 2 --
                     40: int\(0\)
                     41: int\(0\)
                     42: int\(0\)
                     43: int\(-[1-9][0-9]*\)
                     44: int\([1-9][0-9]*\)
                     45: -- Iteration 3 --
                     46: int\(0\)
                     47: int\(0\)
                     48: int\(0\)
                     49: int\(-[1-9][0-9]*\)
                     50: int\([1-9][0-9]*\)
                     51: -- Iteration 4 --
                     52: int\([1-9][0-9]*\)
                     53: int\([1-9][0-9]*\)
                     54: int\([1-9][0-9]*\)
                     55: int\(0\)
                     56: int\([1-9][0-9]*\)
                     57: -- Iteration 5 --
                     58: int\(-[1-9][0-9]*\)
                     59: int\(-[1-9][0-9]*\)
                     60: int\(-[1-9][0-9]*\)
                     61: int\(-[1-9][0-9]*\)
                     62: int\(0\)
                     63: \*\*\* Done \*\*\*

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