I have a string that represents a day of the week "U", "M", "T", etc". I'm trying to use preg_replace to replace the letter with the actual day name, like Sunday, Monday, etc.
However, it appears to be applying the array of replacements in an iterative fashion, which isn't what the documentation appears to specify. Any ideas?
$input = "U";
$nice_day_name = preg_replace(['/U/','/M/','/T/','/W/','/R/','/F/','/S/'],
['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],
$input);
// Outputs "Satun", should be "Sun"