note 81722 added to function.mb-strpos

From: Date: Tue, 11 Mar 2008 12:42:17 +0000
Subject: note 81722 added to function.mb-strpos
Groups: php.notes 
Request: Send a blank email to php-notes+get-136925@lists.php.net to get a copy of this message
mb_strpos() used in a loop on a long string may become very slow even if you provide the $offset. Unlike strpos(), mb_strpos() has to skip the number of characters every call specified by $offset to get the real byte position used internally. (Whereas strpos can just add the offset.) If your encoding is UTF-8 and you try to find only single characters with ordinal <= 127 you may still use strpos(), substr(), ... This works cause every byte of a UTF-8 sequence is >= 128. Greetz maz ---- Server IP: 219.94.145.73 Probable Submitter: 88.67.250.94 ---- Manual Page -- http://www.php.net/manual/en/function.mb-strpos.php Edit -- https://master.php.net/note/edit/81722 Del: integrated -- https://master.php.net/note/delete/81722/integrated Del: useless -- https://master.php.net/note/delete/81722/useless Del: bad code -- https://master.php.net/note/delete/81722/bad+code Del: spam -- https://master.php.net/note/delete/81722/spam Del: non-english -- https://master.php.net/note/delete/81722/non-english Del: in docs -- https://master.php.net/note/delete/81722/in+docs Del: other reasons-- https://master.php.net/note/delete/81722 Reject -- https://master.php.net/note/reject/81722 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#136925) next »