3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '21-11-2016'; $pattern = '/(\d{2})-(\d{2})-(\d{4})/'; $rep = "Month: $2 , Day: $1 , Year: $3"; echo preg_replace($pattern, $rep, $string);

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
205.19 ms | 2244 KiB | 9 Q