NYCPHP Meetup

NYPHP.org

[nycphp-talk] Question about resources for PHP4-based classes

Adam Maccabee Trachtenberg adam at trachtenberg.com
Thu Feb 5 01:34:21 EST 2004


On Wed, 4 Feb 2004, Mitch Pirtle wrote:

> For example, it is commonly stated that PHP4 classes are clearly
> 'stapled on'. Where is a good resource for insight into how to overcome
> these, ah, 'features'?

There are no great resources that I know of that discuss PHP 4 and
OO. I would say the site that does the best job is probably PHP
Patterns (http://www.phppatterns.com/), if you're in to that kind of
thing.

> I'm about to jump into a huge project that is totally PHP4-meets-OOP and
> want to know just how unhappy I will become after all these years in c
> and python :^P

Objects in PHP 4 are really structs with functions. You will probably
hate it. Objects are passed by value and everything is public.

If you're truly looking for a good PHP meets OOP platform, I would
suggest PHP 5. PHP 5 implements most of the Java OO
model. (Constructors, destructors, PPP, final, interfaces, abstract
classes, static, accessors, etc.)

While I wouldn't call PHP 5 production quality today, it works
perfectly well for development. I would say that crashing is less than
a problem than memory leaking, so worse comes to worse you restart
Apache. :)

Depending upon your time frame, PHP 5 will be released before you
launch and you'll be a much happier camper during development. (And
you won't need to port your application to PHP 5 in 4 months.)

-adam

-- 
adam at trachtenberg.com
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!



More information about the talk mailing list