Posted by ~john on 07/14/06 17:59
deciacco wrote:
> Any other suggestions?
> ( I was thinking of having a custom method called echo in myobject so
> one could do echo myobject->echo(); This is not as clean....)
Richard is correct define a function called __toString() in your class
without whatever class variables you want to print off. Notice that
there are 2 underscores on __toString()
You might want to consider an excellent book called PHP 5 Objects,
Patterns, and Practice... I'm reading it now and it covers many of
PHP's advancent features including OO and design patterns.
~john
[Back to original message]
|