note 90148 added to function.substr
| From: | sajjad at sajjad dot biz | Date: | Wed, 08 Apr 2009 07:28:14 +0000 |
| Subject: | note 90148 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-152939@lists.php.net to get a copy of this message | ||
Substring utf-8 strings!
very simple!
<?php
function substru($str,$from,$len){
return preg_replace('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'. $from
.'}'.'((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'. $len
.'}).*#s','$1', $str);
}
?>
----
Server IP: 79.132.192.3
Probable Submitter: 89.165.78.188
----
Manual Page -- http://www.php.net/manual/en/function.substr.php
Edit -- https://master.php.net/note/edit/90148
Del: integrated -- https://master.php.net/note/delete/90148/integrated
Del: useless -- https://master.php.net/note/delete/90148/useless
Del: bad code -- https://master.php.net/note/delete/90148/bad+code
Del: spam -- https://master.php.net/note/delete/90148/spam
Del: non-english -- https://master.php.net/note/delete/90148/non-english
Del: in docs -- https://master.php.net/note/delete/90148/in+docs
Del: other reasons-- https://master.php.net/note/delete/90148
Reject -- https://master.php.net/note/reject/90148
Search -- https://master.php.net/manage/user-notes.php