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_title\]/is' => $title, '/\[\item_text\]/is' => $text, '/\[\item_link\]/is' => $link, ); foreach($regex as $keys => $values) { $temp = preg_replace($keys, $values, $template); } echo $temp
Output for 5.4.0 - 5.4.25
Parse error: syntax error, unexpected end of file, expecting ',' or ';' in /in/6fVM0 on line 37
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected $end, expecting ',' or ';' in /in/6fVM0 on line 37
Process exited with code 255.

preferences:
182.76 ms | 1395 KiB | 62 Q