xref: /PHP-8.0/Zend/tests/006.phpt (revision 5770b667)
1--TEST--
2strncasecmp() tests
3--FILE--
4<?php
5
6try {
7    var_dump(strncasecmp("", "", -1));
8} catch (\ValueError $e) {
9    echo $e->getMessage() . \PHP_EOL;
10}
11
12var_dump(strncasecmp("aef", "dfsgbdf", 0));
13var_dump(strncasecmp("aef", "dfsgbdf", 10));
14var_dump(strncasecmp("qwe", "qwer", 3));
15var_dump(strncasecmp("qwerty", "QweRty", 6));
16var_dump(strncasecmp("qwErtY", "qwer", 7));
17var_dump(strncasecmp("q123", "Q123", 3));
18var_dump(strncasecmp("01", "01", 1000));
19
20?>
21--EXPECT--
22strncasecmp(): Argument #3 ($length) must be greater than or equal to 0
23int(0)
24int(-3)
25int(0)
26int(0)
27int(2)
28int(0)
29int(0)
30