summaryrefslogtreecommitdiff
path: root/inc/utf8.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/utf8.php')
-rw-r--r--inc/utf8.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/inc/utf8.php b/inc/utf8.php
index 0b90c8586..70b16f1a5 100644
--- a/inc/utf8.php
+++ b/inc/utf8.php
@@ -105,7 +105,7 @@ function utf8_check($Str) {
* @see utf8_decode()
*/
function utf8_strlen($string){
- return strlen(utf8_decode($str));
+ return strlen(utf8_decode($string));
}
/**
@@ -126,6 +126,20 @@ function utf8_substr($str,$start,$length=null){
}
/**
+ * Unicode aware replacement for substr_replace()
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ * @see substr_replace()
+ */
+function utf8_substr_replace($string, $replacement, $start , $length=0 ){
+ $ret = '';
+ if($start>0) $ret .= utf8_substr($string, 0, $start);
+ $ret .= $replacement;
+ $ret .= utf8_substr($string, $start+$length);
+ return $ret;
+}
+
+/**
* Unicode aware replacement for explode
*
* @TODO support third limit arg