The strrev Function

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

Syntax

phpstrrev(string $string): string

Example

Let's reverse the string '12345':

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

Code execution result:

php'54321'

See Also

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