The code you posted does not match the method you described; it seems that the description on the PHP manual pages (which, as mentioned in SilentGhost, is just a user comment), is unconfirmed code.
If you need the last day of this month, try the following:
date('Ym-d', strtotime("2009-12 next month - 1 hour"));
source share