@@ -162,6 +162,8 @@ static const struct mb_overload_def mb_ovld[] = {
162
162
{MB_OVERLOAD_STRING , "strpos" , "mb_strpos" , "mb_orig_strrpos" },
163
163
{MB_OVERLOAD_STRING , "strrpos" , "mb_strrpos" , "mb_orig_strrpos" },
164
164
{MB_OVERLOAD_STRING , "substr" , "mb_substr" , "mb_orig_substr" },
165
+ {MB_OVERLOAD_STRING , "strtolower" , "mb_strtolower" , "mb_orig_strtolower" },
166
+ {MB_OVERLOAD_STRING , "strtoupper" , "mb_strtoupper" , "mb_orig_strtoupper" },
165
167
#if HAVE_MBREGEX
166
168
{MB_OVERLOAD_REGEX , "ereg" , "mb_ereg" , "mb_orig_ereg" },
167
169
{MB_OVERLOAD_REGEX , "eregi" , "mb_eregi" , "mb_orig_eregi" },
@@ -189,6 +191,8 @@ const struct def_mbctype_tbl mbctype_tbl[] = {
189
191
190
192
function_entry mbstring_functions [] = {
191
193
PHP_FE (mb_convert_case , NULL )
194
+ PHP_FE (mb_strtoupper , NULL )
195
+ PHP_FE (mb_strtolower , NULL )
192
196
PHP_FE (mb_language , NULL )
193
197
PHP_FE (mb_internal_encoding , NULL )
194
198
PHP_FE (mb_http_input , NULL )
@@ -2580,6 +2584,55 @@ PHP_FUNCTION(mb_convert_case)
2580
2584
}
2581
2585
/* }}} */
2582
2586
2587
+ /* {{{ proto string mb_strtoupper(string sourcestring, [, string encoding])
2588
+ * Returns a uppercased version of sourcestring
2589
+ */
2590
+ PHP_FUNCTION (mb_strtoupper )
2591
+ {
2592
+ char * str , * from_encoding = (char * )mbfl_no2preferred_mime_name (MBSTRG (current_internal_encoding ));
2593
+ long str_len , from_encoding_len ;
2594
+ long case_mode = 0 ;
2595
+ char * newstr ;
2596
+ size_t ret_len ;
2597
+
2598
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "s|s!" , & str , & str_len ,
2599
+ & from_encoding , & from_encoding_len ) == FAILURE ) {
2600
+ RETURN_FALSE ;
2601
+ }
2602
+ newstr = php_unicode_convert_case (PHP_UNICODE_CASE_UPPER , str , str_len , & ret_len , from_encoding TSRMLS_CC );
2603
+
2604
+ if (newstr )
2605
+ RETURN_STRINGL (newstr , ret_len , 0 );
2606
+
2607
+ RETURN_FALSE ;
2608
+ }
2609
+ /* }}} */
2610
+
2611
+ /* {{{ proto string mb_strtolower(string sourcestring, [, string encoding])
2612
+ * Returns a lowercased version of sourcestring
2613
+ */
2614
+ PHP_FUNCTION (mb_strtolower )
2615
+ {
2616
+ char * str , * from_encoding = (char * )mbfl_no2preferred_mime_name (MBSTRG (current_internal_encoding ));
2617
+ long str_len , from_encoding_len ;
2618
+ long case_mode = 0 ;
2619
+ char * newstr ;
2620
+ size_t ret_len ;
2621
+
2622
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "s|s!" , & str , & str_len ,
2623
+ & from_encoding , & from_encoding_len ) == FAILURE ) {
2624
+ RETURN_FALSE ;
2625
+ }
2626
+ newstr = php_unicode_convert_case (PHP_UNICODE_CASE_LOWER , str , str_len , & ret_len , from_encoding TSRMLS_CC );
2627
+
2628
+ if (newstr )
2629
+ RETURN_STRINGL (newstr , ret_len , 0 );
2630
+
2631
+ RETURN_FALSE ;
2632
+ }
2633
+ /* }}} */
2634
+
2635
+
2583
2636
/* {{{ proto string mb_detect_encoding(string str [, mixed encoding_list])
2584
2637
Encodings of the given string is returned (as a string) */
2585
2638
PHP_FUNCTION (mb_detect_encoding )
0 commit comments