3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function escape($string){ if(is_array($string)){ foreach($string as $key => $val){ unset($string[$key]); $string[escape($key)] = escape($val); } }else{ $string = preg_replace("(['\"\x00\\\x1a])","\\\1",$string); } return $string; } $x = "as'd"; print_r(escape($x));
based on IcOOq
Output for 5.4.7 - 7.1.0
Warning: preg_replace(): Null byte in regex in /in/5mNaI on line 10
Output for 4.3.11 - 5.4.6
Warning: preg_replace(): No ending matching delimiter ')' found in /in/5mNaI on line 10
Output for 4.3.0 - 4.3.10
Warning: No ending matching delimiter ')' found in /in/5mNaI on line 10