String_strrev() Function

  • PHP strrev() function is used to reverse a string.
  • The given example shows the use of PHP strrev() function:
<!DOCTYPE html>

<html>

<body>

<?php

echo strrev("www.eitworld.com");

echo "<br>";

echo strrev("Popular Tutorial");

echo "<br>";

echo strrev("PHP Tutorial");

?>

</body>

</html>

Output

string
    In the above example:
  • Reverse string of first string www.eitworld.com is "moc.dlrowtie.www" that's why strrev() function returns moc.dlrowtie.www.
  • Reverse string of Second string Popular Tutorial is "lairotuT ralupoP" that's why strrev() function returns lairotuT ralupoP.
  • Reverse string of Third string PHP Tutorial is "lairotuT PHP" that's why strrev() function returns lairotuT PHP.