note 94652 modified in function.explode by felipe
| From: | felipe@php.net | Date: | Fri, 20 Nov 2009 00:54:43 +0000 |
| Subject: | note 94652 modified in function.explode by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-163118@lists.php.net to get a copy of this message | ||
when the encoding of $string is 'GBK' and $delimiter is '|' , the return value
may be wrong.
for example:
<?php
$result = explode("|", "æ»åå¼¢|æµ·é");
var_dump($result);
?>
and the result will be:
array (
0 => 'æ»å,
1 => '',
2 => 'æµ·é',
)
bcz "å¼¢" 's GBK is '0x8f7c'. and "|" 's ASCII is
'0x7c'.
So, all GBK-encoding characters include '7c' will lead to the error result.
--was--
when the encoding of $string is 'GBK' and $delimiter is '|' , the return value
may be wrong.
for example:
$result = explode("|", "æ»åå¼¢|æµ·é"); var_dump($result);
and the result will be:
array (
0 => 'æ»å,
1 => '',
2 => 'æµ·é',
)
bcz "å¼¢" 's GBK is '0x8f7c'. and "|" 's ASCII is
'0x7c'.
So, all GBK-encoding characters include '7c' will lead to the error result.
http://php.net/manual/en/function.explode.php