PHP Simple implementation of multi-byte string flipping method _php Tutorial

Source: Internet
Author: User

PHP Simple implementation of multi-byte string flipping method


In this paper, we describe a simple way to implement multi-byte string flipping in PHP. Share to everyone for your reference. The implementation method is as follows:

1

2

3

4

5

6

7

8

9

10

11

12

function Mb_strev ($string, $encoding = null) {

if ($encoding = = = null) {

$encoding = mb_detect_encoding ($string);

}

$length = Mb_strlen ($string, $encoding);

$reversed = ";

while ($length--> 0) {

$reversed. = Mb_substring ($string, $length, 1, $encoding);

}

return $reversed;

}

http://www.bkjia.com/PHPjc/977158.html www.bkjia.com true http://www.bkjia.com/PHPjc/977158.html techarticle PHP Simple implementation of multi-byte string flipping method in this paper, we describe a simple way to implement multi-byte string flipping in PHP. Share to everyone for your reference. The concrete implementation method is as follows: ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.