|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-11-29 06:20 UTC] jc at mega-bucks dot co dot jp
The following code using mb_split() is not working as expected:
$EMAIL = $_POST["email"];
echo "ecoding was ".mb_detect_encoding($EMAIL)."<BR>";
list($a, $b) = mb_split("@", $EMAIL);
echo "a is $a <BR>";
echo "b is $b <BR>";
OUTPUT:
??????Test.Com
ecoding was EUC-JP
Notice: Undefined offset: 1 in update_email_pw.php on line 38
a is ??????Test.Com
b is
My internal encodingis set to EUC_JP so I would think that even though I used the ASCII "@" it should work for splitting.
Jc
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 09:00:01 2025 UTC |
This is not a bug. mb_split() distinguishes full-width and half-width characters. So you should simply parenthesise both characters as a regex character class like list($a, $b) = mb_split("[@??]", $EMAIL);