Php extension: how to use mb_ * functions

There are many scripting features in PHP. Is this functionality available to the author of extensions? I would really like to use multibyte functions, but I can not find an example of them.

+3
source share
1 answer

As an example, you can take an exif module . It also depends on the mbstring module and calls its functions "directly", that is, without something like call_user_function_ex (...)

eg.

ZEND_INI_MH(OnUpdateEncode)
{
#if EXIF_USE_MBSTRING
    if (new_value && strlen(new_value) && !php_mb_check_encoding_list(new_value TSRMLS_CC)) {
        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value);
        return FAILURE;
    }
#endif
    return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
}
+2
source

Source: https://habr.com/ru/post/1770051/


All Articles