3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('SITE_URL', 'http://example.com'); $vars = [ 'SITE_URL' => SITE_URL ]; $template = '<p class="card mb-4 shadow-sm"><img src="{{ SITE_URL }}/assets/images/blog/php.png" alt="php" title="php"></p>'; // match any single word with _ or -, with spaces either side or not // e.g: {{key}} or {{ key }} or {{key-foo}} or {{ key-foo }} // not {{ a b c }} $str = preg_replace_callback("/\{\{[ ]{0,}([\w\_-]{1,})[ ]{0,1}\}\}/", function ($match) use ($vars) { return array_key_exists($match[1], $vars) ? $vars[$match[1]] : ''; }, $template); echo $str;
Output for git.master, git.master_jit, rfc.property-hooks
<p class="card mb-4 shadow-sm"><img src="http://example.com/assets/images/blog/php.png" alt="php" title="php"></p>

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
77.75 ms | 405 KiB | 5 Q