3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function mystr_replace($needle,$replace,$haystack){ $args = func_get_args(); if(isset($args[3])){ $count &= $args[3]; } if(is_null($count)) { return str_replace($needle,$replace,$haystack); } else { return str_replace($needle,$replace,$haystack,$count); } } echo mystr_replace("fropfrop","frml","frop"); echo mystr_replace("frop","frml","frop",1);
based on CJhcv
Output for 5.0.4 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined variable: count in /in/JYdgo on line 7 frop Notice: Undefined variable: count in /in/JYdgo on line 5 frml
Output for hhvm-3.12.0
Notice: Undefined variable: count in /in/JYdgo on line 7 fropfrml
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.0 - 4.3.1, 5.0.0 - 5.0.3
Notice: Undefined variable: count in /in/JYdgo on line 7 frop Notice: Undefined variable: count in /in/JYdgo on line 5 frml
Output for 4.3.2 - 4.4.9
Notice: Undefined variable: count in /in/JYdgo on line 7 frop Notice: Undefined variable: count in /in/JYdgo on line 5 Warning: Wrong parameter count for str_replace() in /in/JYdgo on line 10