What's the easiest way to insert slashes after every two characters? For example, changing:
"123108" => "12/31/08"
In this special case you could use [man]chunk_split/man, but more general solutions include using [man]sprintf/man with [man]substr/man, or simply manually inserting slashes with substr().
Just for another alternative (try them all and see which works best for your):
$date = "123108"; $formattedDate = preg_replace('/(\d\d)(\d\d)(\d\d)/', "$1/$2/$3", $date);