Bennett Hollstein

Web developer

[PHP] Completely flip string


for my latest project ( I needed to completely flip a string.

Completely? Yes! ¡sıɥʇ ǝʞıl

For this I needed a PHP function to do so, but I couldn’t found one online so I did one myself. If anyone needs such a function, feel free to use it!

function flipstring($string) {
 // Flipstring function (c) vantezzen
 $string = strrev($string);
 $x = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "m", "n", "r", "t", "v", "w", "y", ".", "[", "(", "{", "?", "!", "\'", "<", "_", ";");
 $y = array("\u0250", "q", "\u0254", "p", "\u01DD", "\u025F", "\u0183", "\u0265", "\u0131", "\u027E", "\u029E", "\u026F", "u", "\u0279", "\u0287", "\u028C", "\u028D", "\u028E", "\u02D9", "]", ")", "}", "\u00BF", "\u00A1", ",", ">", "\u203E", "\u061B");
 $string = str_replace($x, $y, $string);
 return $string;

You need to unicode decode the string afterwords, I used these function to do it:

I used to get the unicode codes. This website does the same thing as the PHP function, just that it uses JavaScript to flip the string.

Leave a Reply

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

* Die Checkbox für die Zustimmung zur Speicherung ist nach DSGVO zwingend.

Ich stimme zu.