3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function compileEchoes($value){ $value = preg_replace ('/\{\{\{\s*(.+?)\s*\}\}\}/s', '<?php echo $1; ?>', $value); return preg_replace ('/\{\{\s*(.+?)\s*\}\}/s', "<?php echo htmlentities($1, ENT_QUOTES, 'UTF-8', false); ?>", $value); } $unescaped = compileEchoes('{{{<strong>Is this bold?</strong>}}}'); echo $unescaped; echo "\n"; $that = compileEchoes('{{<strong>Is this bold?</strong>}}'); echo $that.'\n'; echo htmlentities('<strong>Is this bold?</strong>', ENT_QUOTES, 'UTF-8', false); ?>
Output for 5.2.3 - 7.1.0
<?php echo <strong>Is this bold?</strong>; ?> <?php echo htmlentities(<strong>Is this bold?</strong>, ENT_QUOTES, 'UTF-8', false); ?>\n&lt;strong&gt;Is this bold?&lt;/strong&gt;
Output for 4.3.0 - 5.2.2
<?php echo <strong>Is this bold?</strong>; ?> <?php echo htmlentities(<strong>Is this bold?</strong>, ENT_QUOTES, 'UTF-8', false); ?>\n Warning: htmlentities() expects at most 3 parameters, 4 given in /in/a2e5o on line 11