For a public app - do you think it's a good idea to assume the mb_string extension is enabled on all servers (or alm开发者_如何学Pythonost all, like 95%)?
Are there hosts out there that disable this extension?
I think most have it enabled by default but I've known a few hosting providers that don't, and who also then refused to enable it (never did get a good reason out of them).
If you want all users to be able to install the app on their server without any changes then you'll probably want to roll your own set of functions.
However it might be a better solution to make mb_string
a pre-requisite of your app (and perhaps test for it's existence in the installation script) then you'd be able to save yourself that extra work, while still providing a satisfactory user experience.
If you take Drupal as an example of a public app, they actually roll their own functions (e.g. drupal_substr()
and drupal_strlen()
), in which they test for the existence of the mb_string
extension and make the decision on how to run the function based on that.
精彩评论