3v4l.org

run code in 300+ PHP versions simultaneously
<?php $template = ' <div style="border:1px solid blue;padding:10px;"> <h1>[item_title]</h1> <p>[item_text]</p> <a href="[item_link]">[item_link]</a> </div> <div style="border:1px solid blue;padding:10px;"> <h1>[item_title]</h1> <p>[item_text]</p> <a href="[item_link]">[item_link]</a> </div> '; /// ITEM 1 $title = 'title 1'; $text = 'text text text'; $link = 'http://www.google.com'; /// ITEM 2 $title = 'title 2'; $text = 'text2 text2 text2'; $link = 'http://www.google.com'; $regex = array( '/\[\item_text\]/is' => $text, '/\[\item_link\]/is' => $link, '/\[\item_title\]/is' => $title, ); foreach($regex as $keys => $values) { $template = preg_replace($keys, $values, $template); } echo $template;
Output for git.master, git.master_jit, rfc.property-hooks
Warning: preg_replace(): Compilation failed: unrecognized character follows \ at offset 3 in /in/e8BNN on line 35 Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /in/e8BNN on line 35 Warning: preg_replace(): Compilation failed: unrecognized character follows \ at offset 3 in /in/e8BNN on line 35 Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /in/e8BNN on line 35 Warning: preg_replace(): Compilation failed: unrecognized character follows \ at offset 3 in /in/e8BNN on line 35

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:
53.89 ms | 402 KiB | 8 Q