3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $subject = "we went to see a ewe"; var_dump(str_replace(['e', 'w'], ['w', 'e'], $subject)); var_dump(str_replace([0 => 'e', 1 => 'w'], [0 => 'w', 1 => 'e'], $subject)); var_dump(preg_replace(['/e/', '/w/'], ['w', 'e'], $subject)); var_dump(preg_replace([0 => '/e/', 1 => '/w/'], [0 => 'w', 1 => 'e'], $subject));
Output for 5.6.0 - 7.3.0rc4
string(20) "ee eent to see a eee" string(20) "ee eent to see a eee" string(20) "ee eent to see a eee" string(20) "ee eent to see a eee"