3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myArray = ['yellow', 'green', 'red']; $myString = 'banana is ?, apple is ?, tomato is ?'; do { $myString = preg_replace( '/\?/', array_shift($myArray), $myString, 1, $count ); } while ($count && $myArray); echo $myString; echo "\n\n"; var_export($myArray);

preferences:
36.65 ms | 406 KiB | 5 Q