3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $text='1.4'; echo IHateStrReplace(".","_",$text); function IHateStrReplace($replace_from,$replace_to,$input) { $result=""; for($i=0;$i<strlen($input);$i++) { $result.= ($input[$i]==$replace_from)?$replace_to:$input[$i]; } return $result; }
based on Cjp4G
Output for 4.3.0 - 7.1.0
1_4