This is confusing. I'm creating an index for a MySql table of structure "yyyymm", where "yyyy" is year (e.g. 2011) and "mm" is month (e.g. 02). I acquire them with:
$yyyy = date('Y', time()); $mm = date('m', time());
I subsequently convert them to strings with strval and concatenate them (I've also used the other code below the strval example:
$edition = strval($yyyy) . strval($mm); $edition = "$yyyy" . "$mm";
I then insert $edition into a MySql table as an index of char(6) but the result is always reversed. Instead of $edition being yyyymm (e.g. 201102), it ends up being mmyyyy (e.g. 22011). I can't seem to zero pad the mm either.