3v4l.org

run code in 300+ PHP versions simultaneously
<?php $range = range(1,5); $text = implode(', ', $range); $text = preg_replace('/, (?=[^,]+$)/',' and ', $text); echo $text;

preferences:
44.43 ms | 402 KiB | 5 Q