3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = '/\[CODE\](.*)\[\/CODE\]/'; $replacement = function($m) { return htmlentities($m[0]); }; $subject = <<<EOT <html> <body> <div id="box1">[CODE]<span class="test">Hello World</span>[/CODE]</div> <div id="box2">[CODE]<strong class="test2">Nice to meet you!</strong>[/CODE]</div> </body> </html> EOT; echo preg_replace($pattern, $replacement, $subject);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: preg_replace(): Argument #2 ($replacement) must be of type array|string, Closure given in /in/6KK9G:15 Stack trace: #0 /in/6KK9G(15): preg_replace('/\\[CODE\\](.*)\\[...', Object(Closure), '<html>\n<body>\n<...') #1 {main} thrown in /in/6KK9G on line 15
Process exited with code 255.

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:
50.95 ms | 401 KiB | 8 Q