A blog & community for non-professional web designers, programmers, webmasters, and other web savvies.

Display Text Backwards

February 28, 2011 - 12:00am -- Thomas

This script will display text backwards.

<?php
/*****************
--Display Text Backwards
--More PHP Scripts at
--http://icecaves.net/tags/php
*****************/
$text = "Put your text here and it will display backwards. Put a backslash before any double quotes you use.";
$output = strrev($text);
echo
"<b>String:</b> $text<br><b>Result:</b> $output";
?>
Code Preview: 
String: Put your text here and it will display backwards. Put a backslash before any double quotes you use.
Result: .esu uoy setouq elbuod yna erofeb hsalskcab a tuP .sdrawkcab yalpsid lliw ti dna ereh txet ruoy tuP
Tags: 
Forum Board: 

Comments

theannabella
theannabella's picture
Snowball (?)
Rank Points: 8 (?)
Posts: 86
Status: Offline
WWW

Now that's just really cool. I'm not sure what I'd use this for, but it's seriously cool.

Louise
Louise's picture
Snowball (?)
Rank Points: 6 (?)
Posts: 223
Status: Offline
WWW

This one has always fascinated me. Completely pointless though!

--------------------

"Baldrick, have you no idea what 'irony' is?" "Yes, it's like 'goldy' and 'bronzy' only it's made out of iron."

jenny
jenny's picture
Iceberg (?)
Rank Points: 50 (?)
Age: 17
Posts: 856
Status: Offline
WWW

I just googled what is the use of this and IceCaves was the fourth item that came up. :) I have no idea what it's used for!

--------------------

Jenny-Jen-Jen :D
Bloggity: www.windymill.net
Web-Design Portfolio: www.jenny-aster.net

Jules
Jules's picture
Icicle (?)
Elite Yeti (?)
Rank Points: 32 (?)
Posts: 602
Status: Offline

I've seen it used for online puzzles before. I think it's more for fun.

--------------------

Password is just like your underwear. You have to change it everyday and make sure not to let anyone see it and use it.

Scarlie
Scarlie's picture
Glacier (?)
Elite Yeti (?)
Rank Points: 104 (?)
Posts: 440
Status: Offline

Oooh! This is like the only thing I can do in Java! I use it with a 5x5 grid and I write in code to my Java friends!

--------------------

I'm a jack of all trades in training.

Haily
Haily's picture
Glacier (?)
Ice Lord (?)
Rank Points: 106 (?)
Age: 19
Posts: 761
Status: Offline
WWW

Maybe you could use it to check if a word or string is a palindrome:

<?php
$text
= "redivider";
if(
$text == strrev($text)){
    echo
"It's a palindrome!";
}else{
    echo
"Nope, try again.";
}
?>

Anyway, I'm sure it's useful in complicated programs in some way.

@IceCaves on Twitter

    Stay Connected

    Twitter Facebook Tumblr Google+ Glaciallis Google RSS

    *Follow us on Twitter or Facebook to also follow minor site updates that don't make it to the homepage news.