[thelist] how object oriented is php4

Jackson Yee jyee at vt.edu
Fri Mar 28 18:15:45 CST 2003


"Andrew Embler (ML)" <lists at electricstate.com> wrote in message
news:BAA7C892.C622%lists at electricstate.com...
> Well let's see...I really enjoy working with PHP, so it surprises me that
> I'm going to open this discussion with some mildly disparaging remarks,
but
> one part of PHP that frustrates me (in comparison to true object-oriented
> languages like Java) is its lack of typing. For example, I can't, in a
> class, declare several separate functions which take discreet types.

That's actually function overloading, not typing, Andrew ;-), but I know
what you mean.  PHP4 has very limited support for OOP, especially the lack
of destructors and easy reference notation.

i.e. You must do

$foo =& new bar();

rather than

$foo = new bar();

in order to have the actual object that was constructed instead of a copy of
the object.

PHP5 will be much superior to PHP4 in terms of OOP functionality, but alas,
it hasn't even reached alpha stage yet.  In the meantime, programmers like
myself who are used to using C++ and Java will have to code around PHP4's
lack of functionality.

If you really want to play around with an object-orientated scripting
language, try Ruby at

http://www.rubycentral.com/book/

It enjoys nowhere near the same popularity and support as PHP, but is a very
handy language in its own right.

--
Regards,
Jackson Yee
jyee at vt.edu




More information about the thelist mailing list