xref: /PHP-8.3/Zend/tests/004.phpt (revision 5770b667)
1--TEST--
2strncmp() tests
3--FILE--
4<?php
5
6var_dump(strncmp("", "", 100));
7try {
8    var_dump(strncmp("aef", "dfsgbdf", -1));
9} catch (\ValueError $e) {
10    echo $e->getMessage() . \PHP_EOL;
11}
12var_dump(strncmp("fghjkl", "qwer", 0));
13var_dump(strncmp("qwerty", "qwerty123", 6));
14var_dump(strncmp("qwerty", "qwerty123", 7));
15
16?>
17--EXPECT--
18int(0)
19strncmp(): Argument #3 ($length) must be greater than or equal to 0
20int(0)
21int(0)
22int(-1)
23