How do I reverse a string in PHP?
Now you could write yourself a custom function to do this for you, but as ever, PHP has thoughtfully thought of you and written a function that will take the strain so that you don't have to.
It is extremely simple, so here it is in operation:
<?php
$data = "lets go backwards";
echo strrev($data);
//sdrawkcab og stel
?>
Now you might not be able to come up with immediately any useful applications of this, but they do exist, and when you come across one such application of the function you'll be glad you knew that it existed!
Comment on this Question and Answer >>>
ASK A QUESTION
More strings PHP Questions
How do I print the " in an echo statement?How do I calculate the MD5 hash of a string?
7 Using regular expressions check for the validity of entered email-id. The @ symbol should not appear more than once. The dot (.) can appear at the most once before @ and at the most twice or at least once after @ symbol. The substring before @
How do you hash the password in this php script: define(sb db user name, admin store); define(sb db password, mypassword);
What is the difference between print and echo?
