I have a series of strings in the following format.
temp_low_warning
I am using this code to produce
Warning, Temp Low!
$str = "temp_low_warning";
$parts = explode("_",$str);
$return = ucfirst($parts[2]) . ", " . ucfirst($parts[0]) . " " . ucfirst($parts[1]) . "!";
Is there a better way to do this using regular expressions? I'm more concerned about performance; this script is running as part of a cron job that executes quite frequently.
So I guess my first question is:
Can this be done using Regular Expressions?
Second question:
Should this be done using Regular Expressions?