1--TEST-- 2Test strncasecmp() function: usage variations - single 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 single quoted strings for 'str1', 'str2' */ 11 12echo "*** Test strncasecmp() function: with single quoted strings ***\n"; 13$strings = array( 14 'Hello, World', 15 'hello, world', 16 'HELLO, WORLD', 17 'Hello, World\n' 18); 19/* loop through to compare each string with the other string */ 20$count = 1; 21for($index1 = 0; $index1 < count($strings); $index1++) { 22 echo "-- Iteration $count --\n"; 23 for($index2 = 0; $index2 < count($strings); $index2++) { 24 var_dump( strncasecmp( $strings[$index1], $strings[$index2], (strlen($strings[$index1]) + 1) ) ); 25 } 26 $count ++; 27} 28echo "*** Done ***\n"; 29?> 30--EXPECTREGEX-- 31\*\*\* Test strncasecmp\(\) function: with single quoted strings \*\*\* 32-- Iteration 1 -- 33int\(0\) 34int\(0\) 35int\(0\) 36int\(-[1-9][0-9]*\) 37-- Iteration 2 -- 38int\(0\) 39int\(0\) 40int\(0\) 41int\(-[1-9][0-9]*\) 42-- Iteration 3 -- 43int\(0\) 44int\(0\) 45int\(0\) 46int\(-[1-9][0-9]*\) 47-- Iteration 4 -- 48int\([1-9][0-9]*\) 49int\([1-9][0-9]*\) 50int\([1-9][0-9]*\) 51int\(0\) 52\*\*\* Done \*\*\* 53