Laruence wrote:
Hi:
strn(case)cmp dosen't support a negative length as its third
paramter, while substr dose.
here is the rfc: https://wiki.php.net/rfc/strncmpnegativelen
any question? plz worte me back.
thanks
What do you exactly mean by "in the reverse order" in
if the abs of the negative length is greater than any strlen of the
first two parameters, then strn(case)cmp will work as strncmp in the
reverse order with the abs value:
Looking at
var_dump <http://www.php.net/var_dump>(strncmp
<http://www.php.net/strncmp>("prefix_num", "num", -10));
//outpu: int(7)
it seems to mean that it would be equivalent to
var_dump(strncmp("mun_xiferp", "mun", 10));
However, if I'm reading the patch correctly, it would
be taking the smaller string. Ie. it would be equivalent
to
var_dump <http://www.php.net/var_dump>(strncmp
<http://www.php.net/strncmp>("prefix_num", "num", -3));
Seems an implementation bug.