note 95109 deleted from function.stripos by danbrown
| From: | danbrown@php.net | Date: | Mon, 14 Dec 2009 15:59:47 +0000 |
| Subject: | note 95109 deleted from function.stripos by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-163939@lists.php.net to get a copy of this message | ||
Note Submitter: Klark
----
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.