<?php $text = "here you go"; ?> <font face="Arial Unicode MS"> <script type="text/javascript"> //Author: Frick var s2="<?php echo $text; ?>"; s = s2.toLowerCase(); while (s.indexOf("a") > -1) s = s.replace("a","\u0250"); while (s.indexOf("b") > -1) s = s.replace("b","\u02A0"); while (s.indexOf("c") > -1) s = s.replace("c","\u0254"); while (s.indexOf("d") > -1) s = s.replace("d","\u0440"); while (s.indexOf("e") > -1) s = s.replace("e","\u01DD"); while (s.indexOf("f") > -1) s = s.replace("f","\u025F"); while (s.indexOf("g") > -1) s = s.replace("g","\u0183"); while (s.indexOf("h") > -1) s = s.replace("h","\u0265"); while (s.indexOf("i") > -1) s = s.replace("i","\u0131"); while (s.indexOf("j") > -1) s = s.replace("j","\u027E"); while (s.indexOf("k") > -1) s = s.replace("k","\u029E"); while (s.indexOf("m") > -1) s = s.replace("m","\u026F"); while (s.indexOf("n") > -1) s = s.replace("n","?"); while (s.indexOf("p") > -1) s = s.replace("p","d"); while (s.indexOf("q") > -1) s = s.replace("q","b"); while (s.indexOf("r") > -1) s = s.replace("r","\u0279"); while (s.indexOf("t") > -1) s = s.replace("t","\u0287"); while (s.indexOf("u") > -1) s = s.replace("u","\u043F"); while (s.indexOf("v") > -1) s = s.replace("v","\u028C"); while (s.indexOf("w") > -1) s = s.replace("w","\u028D"); while (s.indexOf("y") > -1) s = s.replace("y","\u028E"); while (s.indexOf("\n") > -1) s = s.replace("\n","\r"); while (s.indexOf(".") > -1) s = s.replace(".","\u02D9"); while (s.indexOf("?") > -1) s = s.replace("?","\u00BF"); while (s.indexOf("!") > -1) s = s.replace("!","\u00A1"); while (s.indexOf("_") > -1) s = s.replace("_","\u203E"); while (s.indexOf(",") > -1) s = s.replace(",","`"); while (s.indexOf("\u0027") > -1) s = s.replace("\u0027","\u0317"); document.write(s); </script></font> PHP:
do you mean this? <? $word = "digitalpoint"; for ($i = strlen($word); $i >= 0; $i--) echo $word[$i]; ?> PHP:
@insert He wants to flip the actual text not reverse, furthermore theirs already a function for what you posted -> strrev().
hey yeh, thanks for that. i've actually just started a thread about a strrev question: http://forums.digitalpoint.com/showthread.php?t=1711246 any ideas?
Here's the same thing in php: function upsideDown($var){ $reverse=strtolower($var); $array=array("a" => "É", "b" => "Ê ", "c" => "É”", "d" => "p", "e" => "Ç", "f" => "ÉŸ", "g" => "ƃ", "h" => "É¥", "i" => "ı", "j" => "ɾ", "k" => "Êž", "m" => "ɯ", "n" => "u", "p" => "d", "q" => "b", "r" => "ɹ", "t" => "ʇ", "u" => "n", "v" => "ÊŒ", "w" => "Ê", "y" => "ÊŽ", "\n" => "\r", "." => "Ë™", "?" => "¿", "!" => "¡", "_" => "‾", "," => "`", "'" => "Ì—"); foreach($array as $key => $value){ $var=str_replace("$key","$value",$var); }//end foreach return $var; }//end function PHP:
thanks for that, but when i try to use the inverted text, i get question marks (in notepad++). this is what i'm seeing: i've also tried "\u0250" for "a" but then that just replaces it with "\u0250" and not the upside down character. any ideas? cheers
oh I just realized when I pasted it, the forum converted the ascii codes I uploaded it to google docs http://docs.google.com/leaf?id=0B-gd83O3SRnVYzc3MGIxN2EtNjM1Ny00Mzk2LWJmNDEtNmQ5YzAzNTAwODQ5&hl=en
that's great thanks, where did you get the ascii codes from as there are a few i wish to change. cheers again!
just hit a little snag, because in the array, "d" is converted to "p" and "p" gets transformed into "d" that means all "d"s always remain as "d"s. is there a way to fix this. cheers once again, you have been really awesome!
You can also do this with plain CSS: friendlybit.com/css/reverse-text-with-css-32-very-special-hex-digits/