3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $sometext = "Some text **that is bold!** and some other text"; $string = explode('**', $sometext); $newStr = ''; for ($i = 0; $i < count($string); ++$i) { if ($i % 2 == 0 || $i == 0) $newStr .= $newStr[$i]."<b>"; else $newStr .= $newStr[$i]."</b>" ; } echo $newStr;
Output for 5.2.10 - 5.6.21, 7.0.0 - 7.1.0
Notice: Uninitialized string offset: 0 in /in/JUvs0 on line 8 <b>b</b>><b>
Output for hhvm-3.10.0 - 3.12.0
<b>b</b>><b>
Output for 4.3.0 - 5.2.9
Notice: Uninitialized string offset: 0 in /in/JUvs0 on line 8 <b>b</b>><b>