PHP Questions Home | Register | Login
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website
Unanswered

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

How do I reverse a string in PHP?


On rare occasions, you might find yourself really wanting to 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 check if a string contains HTML?

How do I fetch the meta tags from a webpage using PHP?

Hello, Is it possible to specify a character-encoding in the filter_var function. Thank you for your reply, Jan

How do I find the position of a letter in a string in PHP?

How do I join strings together?



Custom Search