1--TEST--
2substr_compare()
3--FILE--
4<?php
5
6var_dump(substr_compare("abcde", "df", -2) < 0);
7var_dump(substr_compare("abcde", "bc", 1, 2));
8var_dump(substr_compare("abcde", "bcg", 1, 2));
9var_dump(substr_compare("abcde", "BC", 1, 2, true));
10var_dump(substr_compare("abcde", "bc", 1, 3) > 0);
11var_dump(substr_compare("abcde", "cd", 1, 2) < 0);
12var_dump(substr_compare("abcde", "abc", 5, 1));
13var_dump(substr_compare("abcde", "abcdef", -10, 10) < 0);
14var_dump(substr_compare("abcde", "abc", 0, 0));
15var_dump(substr_compare("abcde", -1, 0, NULL, new stdClass));
16echo "Test\n";
17var_dump(substr_compare("abcde", "abc", 0, -1));
18var_dump(substr_compare("abcde", "abc", -1, NULL, -5) > 0);
19var_dump(substr_compare("abcde", -1, 0, "str", new stdClass));
20
21echo "Done\n";
22?>
23--EXPECTF--
24bool(true)
25int(0)
26int(0)
27int(0)
28bool(true)
29bool(true)
30
31Warning: substr_compare(): The start position cannot exceed initial string length in %s on line %d
32bool(false)
33bool(true)
34int(0)
35
36Warning: substr_compare() expects parameter 5 to be boolean, object given in %s on line %d
37bool(false)
38Test
39
40Warning: substr_compare(): The length must be greater than or equal to zero in %s on line %d
41bool(false)
42bool(true)
43
44Warning: substr_compare() expects parameter 4 to be integer, string given in %s on line %d
45bool(false)
46Done
47