note 95109 added to function.stripos
| From: | Klark at osu1 dot php dot net | Date: | Mon, 14 Dec 2009 09:55:44 +0000 |
| Subject: | note 95109 added to function.stripos | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-163917@lists.php.net to get a copy of this message | ||
It seems that stripos() is working similarly to mb_stripos(), meaning that it supports multi-byte
character encoding.
<?php
$unicode_string =
'ϡϿÓÔ
×©ØØ¶ÜÜߨâââ·â± âtest¡¤Ãâ°Ã¦
«ââ¹âââºâ» ââ¾½¬Ã¹²³´';
$search_for =
'ϡϿÓÔ
×©ØØ¶ÜÜߨâââ·â± âtest';
if (stripos($unicode_string, $search_for) === 0) {
echo "Found using stripos! \n";
}
if (mb_stripos($unicode_string, $search_for, 0, "UTF-8") === 0) {
echo 'Found using mb_stripos!';
}
/*
Output:
Found using stripos!
Found using mb_stripos!
*/
?>
Tested on PHP 5.3 with Unicode UTF-8 strings and mbstring.func_overload turned off.
----
Server IP: 64.71.164.2
Probable Submitter: 68.37.205.26
----
Manual Page -- http://www.php.net/manual/en/function.stripos.php
Edit -- https://master.php.net/note/edit/95109
Del: integrated -- https://master.php.net/note/delete/95109/integrated
Del: useless -- https://master.php.net/note/delete/95109/useless
Del: bad code -- https://master.php.net/note/delete/95109/bad+code
Del: spam -- https://master.php.net/note/delete/95109/spam
Del: non-english -- https://master.php.net/note/delete/95109/non-english
Del: in docs -- https://master.php.net/note/delete/95109/in+docs
Del: other reasons-- https://master.php.net/note/delete/95109
Reject -- https://master.php.net/note/reject/95109
Search -- https://master.php.net/manage/user-notes.php