diff options
author | Stanislav Malyshev <stas@php.net> | 2000-07-26 11:32:15 +0000 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2000-07-26 11:32:15 +0000 |
commit | 1373a16280f98f8d0f3fab762979e7a7400363fe (patch) | |
tree | dcfe5d2d46eddc791bc4a81831d661419426e297 /Zend/zend_builtin_functions.c | |
parent | 9bb4011d06ea64af4b357468e08521d4295e52d3 (diff) | |
download | php-git-1373a16280f98f8d0f3fab762979e7a7400363fe.tar.gz |
Add strncasecmp function
@ Added strncasecmp function (Andi)
Diffstat (limited to 'Zend/zend_builtin_functions.c')
-rw-r--r-- | Zend/zend_builtin_functions.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 079943afef..2bfe2764e1 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -33,6 +33,7 @@ static ZEND_FUNCTION(strlen); static ZEND_FUNCTION(strcmp); static ZEND_FUNCTION(strncmp); static ZEND_FUNCTION(strcasecmp); +static ZEND_FUNCTION(strncasecmp); static ZEND_FUNCTION(each); static ZEND_FUNCTION(error_reporting); static ZEND_FUNCTION(define); @@ -76,6 +77,7 @@ static zend_function_entry builtin_functions[] = { ZEND_FE(strcmp, NULL) ZEND_FE(strncmp, NULL) ZEND_FE(strcasecmp, NULL) + ZEND_FE(strncasecmp, NULL) ZEND_FE(each, first_arg_force_ref) ZEND_FE(error_reporting, NULL) ZEND_FE(define, NULL) @@ -274,6 +276,22 @@ ZEND_FUNCTION(strcasecmp) } /* }}} */ +/* {{{ proto int strncasecmp(string str1, string str2, int len) + Binary safe string comparison */ +ZEND_FUNCTION(strncasecmp) +{ + zval **s1, **s2, **s3; + + if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &s1, &s2, &s3) == FAILURE) { + ZEND_WRONG_PARAM_COUNT(); + } + convert_to_string_ex(s1); + convert_to_string_ex(s2); + convert_to_long_ex(s3); + RETURN_LONG(zend_binary_zval_strncasecmp(*s1,*s2,*s3)); +} +/* }}} */ + ZEND_FUNCTION(each) { zval **array,*entry,**entry_ptr, *tmp; |