Posted by Tim Burgan on 04/12/05 12:07
Hello,
I'm a University student studying Java, but I also do some freelance web
design - so naturally I do a fair bit of PHP which seems to be very
similar to Java.
Usually I just code PHP as I need it, but down the track get REALLY
annoyed when I need to edit or update my code. It's hard to follow and
doesn't really have any order.
Then it came to me - why don't I code PHP with classes and plan my PHP
like I do with Java. So today I looked into the PHP manual to find out
about classes and objects in PHP.
I'm wondering, why does the toString() of classes have two underscored
preceding it [e.g. __toString()], as opposed to Java's normal toString()?
What's the purpose of the two underscores in PHP's classes?
Thanks
Tim
[Back to original message]
|