1--TEST--
2Test strncmp() function: usage variations - different lengths
3--FILE--
4<?php
5/* Prototype  : int strncmp ( string $str1, string $str2, int $len );
6 * Description: Binary safe case-sensitive string comparison of the first n characters
7 * Source code: Zend/zend_builtin_functions.c
8*/
9
10/* Test strncmp() with various lengths */
11
12echo "*** Test strncmp() function: with different lengths ***\n";
13/* definitions of required variables */
14$str1 = "Hello, World\n";
15$str2 = "Hello, world\n";
16
17/* loop through to compare the strings, for various length values */
18for($len = strlen($str1); $len >= 0; $len--) {
19  var_dump( strncmp($str1, $str2, $len) );
20}
21echo "*** Done ***\n";
22?>
23--EXPECTREGEX--
24\*\*\* Test strncmp\(\) function: with different lengths \*\*\*
25int\(-[1-9][0-9]*\)
26int\(-[1-9][0-9]*\)
27int\(-[1-9][0-9]*\)
28int\(-[1-9][0-9]*\)
29int\(-[1-9][0-9]*\)
30int\(-[1-9][0-9]*\)
31int\(0\)
32int\(0\)
33int\(0\)
34int\(0\)
35int\(0\)
36int\(0\)
37int\(0\)
38int\(0\)
39\*\*\* Done \*\*\*
40