3v4l.org

run code in 300+ PHP versions simultaneously
<?php $body = '£¥$@"\'.,;:_-=+*#%&<>?!¿¡§¤()ÄÖÑÜÉÅßÇÆΦΓΔΛΩΣΠΨΘØΞñüäòøàæåèéöùì{}[]|~^€'; $characters = array( 'Δ'=>'0xD0', 'Φ'=>'0xDE', 'Γ'=>'0xAC', 'Λ'=>'0xC2', 'Ω'=>'0xDB', 'Π'=>'0xBA', 'Ψ'=>'0xDD', 'Σ'=>'0xCA', 'Θ'=>'0xD4', 'Ξ'=>'0xB1', '¡'=>'0xA1', '£'=>'0xA3', '¤'=>'0xA4', '¥'=>'0xA5', '§'=>'0xA7', '¿'=>'0xBF', 'Ä'=>'0xC4', 'Å'=>'0xC5', 'Æ'=>'0xC6', 'Ç'=>'0xC7', 'É'=>'0xC9', 'Ñ'=>'0xD1', 'Ö'=>'0xD6', 'Ø'=>'0xD8', 'Ü'=>'0xDC', 'ß'=>'0xDF', 'à'=>'0xE0', 'ä'=>'0xE4', 'å'=>'0xE5', 'æ'=>'0xE6', 'è'=>'0xE8', 'é'=>'0xE9', 'ì'=>'0xEC', 'ñ'=>'0xF1', 'ò'=>'0xF2', 'ö'=>'0xF6', 'ø'=>'0xF8', 'ù'=>'0xF9', 'ü'=>'0xFC', ); $message = ''; if(mb_detect_encoding($body, 'UTF-8') != 'UTF-8') { $body = utf8_encode($body); } for ($i = 0; $i < mb_strlen($body, 'UTF-8'); $i++) { $c = mb_substr($body, $i, 1, 'UTF-8'); if (isset($characters[$c])) { $message .= chr(hex2dec($characters[$c])); } else { $message .= $c; } } echo $message;

preferences:
34.57 ms | 408 KiB | 5 Q