Here's the patch against 1.4. I adapted the instructions a little, for example, to refer to php-mode-hook instead of php-mode-user-hook. I also added the "final" keyword to the function regexp. But for the most part, it's the same patch with different context so it applies cleanly.
I only have emacs21 installed, so that's all I tested against. I'd love to hear from someone with emacs22 about whether it works there, too.
I didn't see how to upload an additional patch to #2027841, so I've opened this new one instead.
From 2027841:
This patch organizes the imenu by PHP class. Functions appear in the imenu (or speedbar) under the class in which they are defined, not under an unwieldy list of all functions.
With the improved organization, the PHP mode imenu becomes much more useful for conveying a code overview.
http://www.oak.homeunix.org/~marcel/blog/articles/2008/07/18/nested-imenu-for-php
unified diff against 1.4
This is a great idea. I wish it was easier to accomplish -- easier to parse classes with CC mode's help, and easier to provide to Imenu. There are other bugs fixed related to Imenu in the next release. Perhaps we can take this feature request up down the road.