hipmaestro wrote in php

Is there a way in php to override whatever it is that handles how an object gets converted to a string?

For example, this code:

class A
{
  // stuff
}

$a = new A();
print $a;


prints this:

Object id #1


Is there a method I can add to the class that overrides what text should be printed when an object is directly printed?

I've tried toString, hoping for a parallel with Java and JavaScript, but no luck.

Thanks.