Patch bug36944.phpt for Strings related Bug #36944
Patch version 2011-07-25 11:40 UTC
Return to Bug #36944 |
Download this patch
Patch Revisions:
Developer: laruence@php.net
--TEST--
strn(case)cmp supporting negative length
--FILE--
<?php
echo "strncmp:\n";
var_dump(strncmp("laruence", "nce", 3));
var_dump(strncmp("laruence", "nce", -3));
var_dump(strncmp("laruence", "nce", -1));
var_dump(strncmp("laruence", "nce", 0));
var_dump(strncmp("laruence", "nce", 20));
var_dump(strncmp("laruence", "nce", -10));
echo "strncasecmp:\n";
var_dump(strncasecmp("larueNce", "nce", 3));
var_dump(strncasecmp("laruenCe", "nce", -3));
var_dump(strncasecmp("laruenCE", "nce", -1));
var_dump(strncasecmp("laruencE", "nce", 0));
var_dump(strncasecmp("laruence", "nce", 20));
var_dump(strncasecmp("larUeNce", "nce", -10));
--EXPECT--
strncmp:
int(-1)
int(0)
int(0)
int(0)
int(-1)
int(5)
strncasecmp:
int(-2)
int(0)
int(0)
int(0)
int(-2)
int(5)
|