3v4l.org

run code in 300+ PHP versions simultaneously
<?php $customTemplate = " <div> <<This>> <<that>> </div> "; $MyClass = new class{ function get($tag) { if ($tag == 'This') return '<h1>Something</h1>'; if ($tag == 'that') return '<p>For example</p>'; return '**not found**'; } }; function process_template($template, $MyClass, $begin = '<<', $end = '>>') { return preg_replace_callback("/$begin(\w+)$end/", function($var) use ($MyClass) { return $MyClass->get($var[1]); }, $template); } $processed = process_template($customTemplate, $MyClass); var_dump($processed);
Output for git.master, git.master_jit, rfc.property-hooks
string(60) " <div> <h1>Something</h1> <p>For example</p> </div> "

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:
175.17 ms | 405 KiB | 5 Q