3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $string = 'The quick brown fox jumped over the lazy dog.'; $patterns = array(); $patterns[0] = '/quick/'; $patterns[1] = '/brown/'; $patterns[2] = '/fox/'; $replacements = array(); $replacements[2] = 'bear'; $replacements[1] = 'black'; $replacements[0] = 'slow'; echo preg_replace($patterns, $replacements, $string); ?>
Output for 4.3.0 - 7.1.0
The bear black slow jumped over the lazy dog.