Google News
logo
PHP Program to Reverse a string - strrev()
The `strrev()` function in PHP is used to reverse a string. It takes one string argument and returns the reversed string.

Here's an example :
Program :
<?php
$string = "Hello, world!";
$reversed = strrev($string);
echo $reversed;
?>
Output :
!dlrow ,olleH
In this example, we first define a string variable `$string` with the value "Hello, world!". We then use the `strrev()` function to reverse the string and store the result in a new variable `$reversed`.

Finally, we use `echo` to output the reversed string, which is "!dlrow ,olleH".