3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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(array_keys($keys), array_values($values), $template); }
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: array_keys() expects parameter 1 to be array, string given in /in/3hA0D on line 34 Warning: array_values() expects parameter 1 to be array, string given in /in/3hA0D on line 34 Warning: preg_replace(): Empty regular expression in /in/3hA0D on line 34 Warning: array_keys() expects parameter 1 to be array, string given in /in/3hA0D on line 34 Warning: array_values() expects parameter 1 to be array, string given in /in/3hA0D on line 34 Warning: preg_replace(): Empty regular expression in /in/3hA0D on line 34 Warning: array_keys() expects parameter 1 to be array, string given in /in/3hA0D on line 34 Warning: array_values() expects parameter 1 to be array, string given in /in/3hA0D on line 34 Warning: preg_replace(): Empty regular expression in /in/3hA0D on line 34
Output for hhvm-3.12.0
Warning: array_keys() expects parameter 1 to be an array or collection in /in/3hA0D on line 34 Warning: array_values() expects parameter 1 to be an array or collection in /in/3hA0D on line 34 Warning: Empty regular expression in /in/3hA0D on line 34 Warning: array_keys() expects parameter 1 to be an array or collection in /in/3hA0D on line 34 Warning: array_values() expects parameter 1 to be an array or collection in /in/3hA0D on line 34 Warning: Empty regular expression in /in/3hA0D on line 34 Warning: array_keys() expects parameter 1 to be an array or collection in /in/3hA0D on line 34 Warning: array_values() expects parameter 1 to be an array or collection in /in/3hA0D on line 34 Warning: Empty regular expression in /in/3hA0D on line 34
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.11 - 5.2.17
Warning: array_keys(): The first argument should be an array in /in/3hA0D on line 34 Warning: array_values(): The argument should be an array in /in/3hA0D on line 34 Warning: preg_replace(): Empty regular expression in /in/3hA0D on line 34 Warning: array_keys(): The first argument should be an array in /in/3hA0D on line 34 Warning: array_values(): The argument should be an array in /in/3hA0D on line 34 Warning: preg_replace(): Empty regular expression in /in/3hA0D on line 34 Warning: array_keys(): The first argument should be an array in /in/3hA0D on line 34 Warning: array_values(): The argument should be an array in /in/3hA0D on line 34 Warning: preg_replace(): Empty regular expression in /in/3hA0D on line 34
Output for 4.3.2 - 4.3.10
Warning: array_keys(): The first argument should be an array in /in/3hA0D on line 34 Warning: array_values(): The argument should be an array in /in/3hA0D on line 34 Warning: Empty regular expression in /in/3hA0D on line 34 Warning: array_keys(): The first argument should be an array in /in/3hA0D on line 34 Warning: array_values(): The argument should be an array in /in/3hA0D on line 34 Warning: Empty regular expression in /in/3hA0D on line 34 Warning: array_keys(): The first argument should be an array in /in/3hA0D on line 34 Warning: array_values(): The argument should be an array in /in/3hA0D on line 34 Warning: Empty regular expression in /in/3hA0D on line 34
Output for 4.3.0 - 4.3.1
Warning: array_keys() [http://www.php.net/function.array-keys]: The first argument should be an array in /in/3hA0D on line 34 Warning: array_values() [http://www.php.net/function.array-values]: The argument should be an array in /in/3hA0D on line 34 Warning: Empty regular expression in /in/3hA0D on line 34 Warning: array_keys() [http://www.php.net/function.array-keys]: The first argument should be an array in /in/3hA0D on line 34 Warning: array_values() [http://www.php.net/function.array-values]: The argument should be an array in /in/3hA0D on line 34 Warning: Empty regular expression in /in/3hA0D on line 34 Warning: array_keys() [http://www.php.net/function.array-keys]: The first argument should be an array in /in/3hA0D on line 34 Warning: array_values() [http://www.php.net/function.array-values]: The argument should be an array in /in/3hA0D on line 34 Warning: Empty regular expression in /in/3hA0D on line 34