PHP: Hypertext Preprocessor (original) (raw)

strrev

(PHP 4, PHP 5, PHP 7, PHP 8)

strrev — Reverse a string

Description

Parameters

string

The string to be reversed.

Return Values

Returns the reversed string.

Examples

Example #1 Reversing a string with strrev()

<?php echo strrev("Hello world!"); // outputs "!dlrow olleH" ?>

Found A Problem?

info at ensostudio dot ru

4 years ago

`<?php
/**

tianyiw at vip dot qq dot com

6 years ago

`This function support utf-8 encoding, Human Language and Character Encoding Support:

i>=0;i>=0; i>=0;i--) { r.=mbsubstr(r .= mb_substr(r.=mbsubstr(str, $i, 1); } return $r; } echo mb_strrev("☆❤world"); // echo "dlrow❤☆" ?>

`