59 of 410 menu

The strrev Function

The strrev function reverses a string so that the characters are in reverse order.

Syntax

strrev(string $string): string

Example

Let's reverse the string '12345':

<?php echo strrev('12345'); ?>

Code execution result:

'54321'

See Also

  • the str_shuffle function,
    which shuffles the characters of a string
  • the array_reverse function,
    which reverses an array
byenru