|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-03-17 09:47 UTC] ez dot amiryo at gmail dot com
[2010-03-17 09:52 UTC] aharvey@php.net
-Status: Closed
+Status: Bogus
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 11:00:02 2025 UTC |
Description: ------------ str_replace doesn't work properly with non-ascii(128~) characters in arrays. I tested below script on cp949 machine. Test script: --------------- <?php echo ConvertPokerCardString( 'QS 4C JC 9D JH 7H AC' ); function ConvertPokerCardString( $str ) { return( str_replace( array('D','S','H','C'), array('◆','♠','♥'.'♣'), $str ) ); // below codes works well. /* $str = str_replace( 'D', '◆', $str ); $str = str_replace( 'H', '♥', $str ); $str = str_replace( 'S', '♠', $str ); $str = str_replace( 'C', '♣', $str ); return $str; */ } ?> Expected result: ---------------- Q♠ 4♣ J♣ 9◆ J♥ 7♥ A♣ Actual result: -------------- Q♠ 4 J 9◆ J♥♣ 7♥♣ A