How to reverse a string in PHP
Topic: PHP / MySQLPrev|Next
Answer: Use the PHP strrev()
function
You can use the PHP strrev()
to reverse the text writing direction of a string.
Let's take a look at an example to understand how it basically works:
Example
Try this code »<?php
echo strrev("Hello world!"); // Outputs: "!dlrow olleH"
?>
Related FAQ
Here are some more FAQ related to this topic: