3 * This is the dynamic loader for the library. It checks whether you have
4 * the mbstring extension available and includes relevant files
5 * on that basis, falling back to the native (as in written in PHP) version
6 * if mbstring is unavailabe.
8 * It's probably easiest to use this, if you don't want to understand
9 * the dependencies involved, in conjunction with PHP versions etc. At
10 * the same time, you might get better performance by managing loading
11 * yourself. The smartest way to do this, bearing in mind performance,
12 * is probably to "load on demand" - i.e. just before you use these
13 * functions in your code, load the version you need.
15 * It makes sure the the following functions are available;
16 * utf8_strlen, utf8_strpos, utf8_strrpos, utf8_substr,
17 * utf8_strtolower, utf8_strtoupper
18 * Other functions in the ./native directory depend on these
19 * six functions being available
24 * Put the current directory in this constant
26 if ( !defined('UTF8') ) {
27 define('UTF8',dirname(__FILE__));
31 * Check whether PCRE has been compiled with UTF-8 support
34 if ( preg_match('/^.{1}$/u',"ñ",$UTF8_ar) != 1 ) {
35 trigger_error('PCRE is not compiled with UTF-8 support',E_USER_ERROR);
41 * Load the smartest implementations of utf8_strpos, utf8_strrpos
44 if ( !defined('UTF8_CORE') ) {
45 if ( function_exists('mb_substr') ) {
46 require_once UTF8 . '/mbstring/core.php';
48 require_once UTF8 . '/utils/unicode.php';
49 require_once UTF8 . '/native/core.php';
54 * Load the native implementation of utf8_substr_replace
56 require_once UTF8 . '/substr_replace.php';
59 * You should now be able to use all the other utf_* string functions