1--TEST--
2Test strncasecmp() function : basic functionality
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
10echo "*** Testing strncasecmp() function: basic functionality ***\n";
11
12echo "-- Testing strncasecmp() with single quoted string --\n";
13var_dump( strncasecmp('Hello', 'Hello', 5) );  //expected: int(0)
14var_dump( strncasecmp('Hello', 'Hi', 5) );  //expected: value < 0
15var_dump( strncasecmp('Hi', 'Hello', 5) );  //expected: value > 0
16
17echo "-- Testing strncasecmp() with double quoted string --\n";
18var_dump( strncasecmp("Hello", "Hello", 5) );  //expected: int(0)
19var_dump( strncasecmp("Hello", "Hi", 5) );  //expected: value < 0
20var_dump( strncasecmp("Hi", "Hello", 5) );  //expected: value > 0
21
22echo "-- Testing strncasecmp() with here-doc string --\n";
23$str = <<<HEREDOC
24Hello
25HEREDOC;
26var_dump( strncasecmp($str, "Hello", 5) );  //expected: int(0)
27var_dump( strncasecmp($str, "Hi", 5) );  //expected: value < 0
28var_dump( strncasecmp("Hi", $str, 5) );  //expected: value > 0
29
30echo "*** Done ***";
31?>
32--EXPECTREGEX--
33\*\*\* Testing strncasecmp\(\) function: basic functionality \*\*\*
34-- Testing strncasecmp\(\) with single quoted string --
35int\(0\)
36int\(-[1-9][0-9]*\)
37int\([1-9][0-9]*\)
38-- Testing strncasecmp\(\) with double quoted string --
39int\(0\)
40int\(-[1-9][0-9]*\)
41int\([1-9][0-9]*\)
42-- Testing strncasecmp\(\) with here-doc string --
43int\(0\)
44int\(-[1-9][0-9]*\)
45int\([1-9][0-9]*\)
46\*\*\* Done \*\*\*
47