I have a date in this format (extracted from a specific script), on which I'd like to remove ALL spaces :
$date="Date: Tue Aug 2 10:43"
Quite easy, but the trick is: prior to this, I'd like to add a "0" before the "2" (or any other 9th first days of the month), BUT the "0" has to replace the second space between "Aug" and "2". What is the best way to achieve this ?
Keep in mind that the date will (obviously) change each day, so we can't simply do something like this:
$date=str_replace("Aug 2","Aug 02",$date);
Instead, I think the best way would be to do something like:
$date=str_replace("[x] [x]","[x] 0[x]",$date);
[x] meaning: "Any non-whitespace character" (please excuse me for this approximation !)