[KLUG Programming] Subtley *NASTY* PHP4/5 Difference

Robert G. Brown bob at whizdomsoft.com
Fri Apr 8 08:21:58 EDT 2005


>> > I don't remember what PHP3 did.. anyone out there who does, please
>> > don't be shy!
>> Well, my PHP experience is still on the light side, but my impression of
>> objects in 3 and 4 has been they're basically fancy structures with
>> member functions, and that's about it. 
>Yep.
Inded, I did not wan tto imply otherwise. Some of my comments were directed
towards OOP in general, not particular versions of one language or another.

>> No provision for defining
>> destructors, nor access control to an object's "internal" elements; if
>> the class includes it, anything can screw with it. 
>Yes.
Very C-like. Actually C "objects" are modeled as structs with pointers to 
functions. I actually had to do this before I learned C++, and was surprised
to see how much of the stuff I had to do was discussed in Stroustup's books.
I did have to write a pretty messy and general object destroyer, too. Some
of this work is done for you by the memory manager in "real" OO languages.

>> From what little I've
>> read, I get the impression that PHP5 has become rather more disciplined,
>> with provisions for those and other features. I think it might even have
>> a compiler now, though I'd have to check again. All in all, I've gained
>> the impression that PHP has matured considerably with version 5, which
>> in my opinion is mostly a Good Thing.
>My *impression* as well.

I have not used PhP5 yet, but I would not be a happy camper if something that 
was rpcDate in pHp3 became rpcdate in phP4, forcing me to munge my code (or at
least become nervous about it), and then it became rpcDate again in PHp5,
which would tempt me to re-munge my code AGAIN (to get rid of the cruft I was 
forced to introduce by pHP4). Stuff like this had better have a reason, other 
than being a mere defect. This is the sort of thing that breeds disaffection 
among folk like me. One of the things that happens over time is that the 
implementors converge on (hopefully right) design choices over time; if that 
comes at pain of some munging, so be it.
							Regards,
							---> RGB <---



More information about the Programming mailing list