3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<!DOCTYPE html> <html> <body> <?php $arr = array("blue","red","green","yellow"); print_r(str_replace("\\","yey",$arr,$i)); echo "<br>" . "Replacements: $i"; ?> <p>\In this example, we search an array to find the value "red", and then we replace the value "red" with "pink".</p> </body> </html>
based on 1PmIg
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.0
<!DOCTYPE html> <html> <body> Array ( [0] => blue [1] => red [2] => green [3] => yellow ) <br>Replacements: 0 <p>\In this example, we search an array to find the value "red", and then we replace the value "red" with "pink".</p> </body> </html>