_mb_substr [ WordPress Function ]
_mb_substr ( $str, $start, $length = null, $encoding = null )
| Defined at: |
|
Soorgelijke functies: mb_substr, _maybe_update_core
No description yet.
Source
<?php
function _mb_substr( $str, $start, $length=null, $encoding=null ) {
// the solution below, works only for utf-8, so in case of a different
// charset, just use built-in substr
$charset = get_option( 'blog_charset' );
if ( !in_array( $charset, array('utf8', 'utf-8', 'UTF8', 'UTF-8') ) ) {
return is_null( $length )? substr( $str, $start ) : substr( $str, $start, $length);
}
// use the regex unicode support to separate the UTF-8 characters into an array
preg_match_all( '/./us', $str, $match );
$chars = is_null( $length )? array_slice( $match[0], $start ) : array_slice( $match[0], $start, $length );
return implode( '', $chars );
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- PHP: mb_substr - Manual
Parameters. str. The string to extract the substring from. start. Position of first character to use from str . length. Maximum number of characters to use from str .
php.net - PHP: mb_substr_count - Manual
6 days ago ... Parameters. haystack. The string being checked. needle. The string being found. encoding. The encoding parameter is the character encoding.
php.net - PHP tutorial: mb-substr function
PHP tutorial: mb-substr function.
www.phptutorial.info - PHPXRef 0.7 : BackPress : /includes/functions.compat.php source
... 102 { 103 return _mb_substr( $str, $start, $length, $encoding ); 104 } 105 } 106 107 if ( !function_exists( '_mb_substr' ) ) { 108 function _mb_substr( $str, $start, ...
phpxref.ftwr.co.uk