Req #69512 [Opn]: No multibyte strrev function

From: Date: Thu, 23 Apr 2015 13:14:14 +0000
Subject: Req #69512 [Opn]: No multibyte strrev function
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192292@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69512&edit=1 ID: 69512 Updated by: requinix@php.net Reported by: 550794054 at qq dot com -Summary: "strrev" cannot support non-English string +Summary: No multibyte strrev function Status: Open Type: Feature/Change Request -Package: PHP Language Specification +Package: Strings related Operating System: windows PHP Version: 5.6.8 Block user comment: N Private report: N New Comment: strrev(), like most other string functions, operate on bytes. They are not suitable for multibyte strings. There is no "mb_strrev" function so I'm turning this ticket into a feature request for one. Meanwhile the best option *for UTF-8 strings* I can think of is to use preg_split() or _match() with /u to split the input into characters, reverse the array, and implode() them back together. Previous Comments: ------------------------------------------------------------------------ [2015-04-23 13:02:47] 550794054 at qq dot com Description: ------------ --- From manual page: http://www.php.net/function.strrev --- I find the instruction "strrev" cannot support non-English string,if want to reverse like chinese string ,Janpanese string,or Russian string,"strrev" will display gibberish.even add Prefix "mb_" also not support. Test script: --------------- <?php $str="我的名字叫小明”; $str1=strrev($str); echo $str1; ?> Expected result: ---------------- maybe it's the problem belongs to C.but I also want to PHP group can fix the problem. Thank you! ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69512&edit=1

« previous php.bugs (#192292) next »