3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $ldq = preg_quote('{', '~'); $rdq = preg_quote('}', '~'); $search = "~{$ldq}\*(.*?)\*{$rdq}|{$ldq}\s*literal\s*{$rdq}(.*?){$ldq}\s*/literal\s*{$rdq}|{$ldq}\s*php\s*{$rdq}(.*?){$ldq}\s*/php\s*{$rdq}~s"; $source_content = '{literal}<script type="javascript">alert(\'foo\');</script>{/literal}'; $source_content = preg_replace($search.'e', "'" . $ldq . 'php' . "' . str_repeat(\"\n\", substr_count('\\0', \"\n\")) .'" . $rdq . "'" , $source_content); echo $source_content;
based on 7tl9l
Output for 7.0.19 - 7.0.20, 7.1.5 - 7.3.0rc3
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /in/l6Yah on line 15
Output for 7.0.0 - 7.0.18, 7.1.0 - 7.1.4
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /in/l6Yah on line 14
Output for 5.3.29, hhvm-3.15.4
\{php\}
Output for 5.6.0 - 5.6.30
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /in/l6Yah on line 15 \{php\}