A Little Noise



What, if anything, is the minimum change (fewest inserted/deleted/modified characters) required to make the output The result is bar:

class A {
  private $foo = "bar";
  public function __toString() {
    return $this->foo;

$myObject = new A();
echo "The result is " . $myObject;

Show Answer ▼

Comments (2) Trackbacks (0)
  1. Was this specific for a particular PHP version? Because no modifications would already produce the desired output in PHP5

  2. Must have been PHP 4, and must have had something to do with the way that objects were evaluated for concatenation rather than separately. If I had PHP 4 installed, I’d try it.

Leave a comment


No trackbacks yet.