Follow
Follow

How to reverse a string in PHP

strrev() function

The strrev() function is an built-in function in PHP which is used to reverse strings.

Syntax:

strrev(string)

string – This parameter is required. It specifies the string to reverse.

Example:

<?php
echo strrev("PHP Tutorials!"); // Output: "!slairotuT PHP"
?>
Newsletter
Join Design Community
Get the latest updates, creative tips, and exclusive resources straight to your inbox. Let’s explore the future of design and innovation together.