Re: [PHP] Why does PHP have __toString() and not just toString()

2005-04-12 Thread M. Sokolewicz
Rory Browne wrote: I was wondering that as well. While I was at it, I wondered why not use __to_str(), as per the PHP coding guidelines. because that's *against* php coding guidelines :) You should have a look at the guidelines for METHOD-naming, which is part of the OOP part. It states that for m

Re: [PHP] Why does PHP have __toString() and not just toString()

2005-04-12 Thread Rory Browne
I was wondering that as well. While I was at it, I wondered why not use __to_str(), as per the PHP coding guidelines. While I'm at it, why is grass green, and milk white? On Apr 12, 2005 10:27 AM, Richard Davey <[EMAIL PROTECTED]> wrote: > Hello Tim, > > Tuesday, April 12, 2005, 10:07:44 AM, you

Re: [PHP] Why does PHP have __toString() and not just toString()

2005-04-12 Thread Richard Davey
Hello Tim, Tuesday, April 12, 2005, 10:07:44 AM, you wrote: TB> I'm wondering, why does the toString() of classes have two underscored TB> preceding it [e.g. __toString()], as opposed to Java's normal toString()? TB> What's the purpose of the two underscores in PHP's classes? The short answer:

[PHP] Why does PHP have __toString() and not just toString()

2005-04-12 Thread Tim Burgan
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 fo