3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $pj = array('title' => 'My Title Pj', 'price' => '4 $', 'comment' => 'Cool!', 'favicon' => './img/favicon-435.jpg'); $tmp = "Title.... {Title} \r\n"; $tmp .= "Price: {Price} \r\n"; $tmp .= "Comment: {Comment} \r\n"; foreach($pj as $k => $v){ $k = ucfirst($k); $tmp = str_replace("{" . $k . "}", $v, $tmp); } echo $tmp;
based on bdK2X
Output for 5.6.0 - 7.3.0rc3
Title.... My Title Pj Price: 4 $ Comment: Cool!