3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $comma = "0,1,,,,,,,"; $str = "test"; //$comma = " " . $comma; $i=0; $pos=0; While($i != 3){ $pos = strpos($comma, ",", $pos+1); $i++; } Echo substr($comma,1,$pos) . $str . Substr($comma,$pos+1);
based on tWWFd
Output for 5.6.0 - 5.6.30, hhvm-3.18.4 - 3.21.0, 7.0.0 - 7.3.0rc3
,1,,test,,,,,