note 87114 added to function.mb-strlen

From: Date: Wed, 19 Nov 2008 22:59:26 +0000
Subject: note 87114 added to function.mb-strlen
Groups: php.notes 
Request: Send a blank email to php-notes+get-146731@lists.php.net to get a copy of this message
If you find yourself without the mb string functions and can't easily change it, a quick hack replacement for mb_strlen for utf8 characters is to use a a PCRE regex with utf8 turned on. $strlen = preg_match_all("/.{1}/us",$utf8string,$dummy); This is basically an ugly hack which counts all single character matches, and I'd expect it to be painfully slow on large strings. ---- Server IP: 208.69.120.35 Probable Submitter: 63.249.90.232 ---- Manual Page -- http://www.php.net/manual/en/function.mb-strlen.php Edit -- https://master.php.net/note/edit/87114 Del: integrated -- https://master.php.net/note/delete/87114/integrated Del: useless -- https://master.php.net/note/delete/87114/useless Del: bad code -- https://master.php.net/note/delete/87114/bad+code Del: spam -- https://master.php.net/note/delete/87114/spam Del: non-english -- https://master.php.net/note/delete/87114/non-english Del: in docs -- https://master.php.net/note/delete/87114/in+docs Del: other reasons-- https://master.php.net/note/delete/87114 Reject -- https://master.php.net/note/reject/87114 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#146731) next »