3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $s = 'Happy^ hour^ / is fun //'; function filenameEncode($possible_filename){ $fngood = str_replace(array('^',';','/',':'), array('^^',';;','^',';'), $possible_filename); return $fngood; } function filenameDecode($possible_filename){ $fngood = str_replace(array('^^',';;','^',';'), array('^',';','/',':'), $possible_filename); return $fngood; } echo $s."\n"; $t = filenameEncode($s); $u = filenameDecode($t); if ($s === $t){ echo 'test passed'; }
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Happy^ hour^ / is fun //