PHP implements Chinese and English reverse order
Aug 08, 2016 am 09:28 AM<?php
/*
* Created on 2011-11-09
* @author sundebiao
* This can achieve the reverse order of strings
* Supports pure English numbers, pure Chinese strings and mixed Chinese and English number strings
* Chinese needs to use GBK encoding
* If the incoming parameter is not a string, false will be returned
*/
function strrev_ext ($str)
{
$str = iconv('UTF-8', 'GBK', $str) ;
if (is_string($str)) {
$len = strlen($str);
$newstr = "";
for ($i = $len - 1; $i >= 0; $i -- ) {
else {
$newstr. }
}
//Function usage demonstration
//Pure English characters
$str ="abcde";
echo strrev_ext($str)."<br />";
//Pure Chinese characters
$str1 = "Chinese";
echo strrev_ext($str1)."<br /> ;";
//Chinese and English mixed
$str2= "中文国US人1br";
echo strrev_ext($str2)."<br />";
The above introduces the implementation of Chinese and English reverse order in PHP, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Hot tools Tags

Hot Article

Hot tools Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Solution: Your organization requires you to change your PIN

How to adjust window border settings on Windows 11: Change color and size

How to enable or disable taskbar thumbnail previews on Windows 11

How to change title bar color on Windows 11?

OOBELANGUAGE Error Problems in Windows 11/10 Repair

10 Ways to Adjust Brightness on Windows 11

How to turn off private browsing authentication for iPhone in Safari?
