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);

preferences:
32.47 ms | 404 KiB | 5 Q