PHP Text Flipper Library

Have you seen some cool webapps where you can write English texts upside down?

I have found out the techniques. They just use some Unicode characters to do the trick. Unicode has a vast collection of characters and you have to find the right one that looks like an upside down english character.

I have written a PHP library to do the job .
Visit the demo at:
http://masnun.com/flipper/ :D
Download the Library at:
http://masnun.googlecode.com/files/flipper.php :)

Here’s the source code of the demo:

<?php
header("Content-type: text/html; charset='utf-8'");
echo "<html><head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
<title>maSnun's string flipper</title><body>
<form action=\"index.php\" method=\"POST\">
<b>Enter a string:</b><br />
<input type=\"text\" name=\"string\" value=\"{$_POST['string']}\">
<input type=\"submit\" value=\"flipNow()\">
</form><br /><br />";
 
if(isset($_POST['string'])) {
include('flipper.php');
$stringFlipper = new StringFlipper;
$str = $stringFlipper->flipString($_POST['string']);
echo "<b>Flipped String:</b><input type=\"text\" value=\"$str\"> <br /><br />";
 
}
 
echo "</body><html>";
 
?>

PS: PHP and web browsers have some issues regarding Unicode data. So please ensure the “Content-type” is set to “text/html” and the charset is “utf-8″ :)

Happy flipping :D

This entry was posted in Blog Post and tagged . Bookmark the permalink.

6 Responses to PHP Text Flipper Library

  1. Pingback: Tweets that mention PHP Text Flipper Library | maSnun.com -- Topsy.com

  2. john says:

    Sweet! Nice post :)

  3. Hi mansun,

    nice idea and good class.
    I did a short cleanup of your code and reduced number of lines by nearly 2 :D

    http://juliusbeckmann.de/blog/rewrite-php-string-flipper-class.html

    Regards, Julius.

  4. GR8! I like it, yet bro, you have poor collection of charecters :(

  5. maSnun says:

    @Salman Morshed
    Man, do you fancy spending time finding cooler characters in the vast collection of Unicode ?

  6. YAP! Exactly…….. :D

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">