<?php
class Foo {
public function returnToTheBar(Bar $bar) {
$bar->getFoo($this);
}
}
class Bar {
public $foo;
public function getFoo($foo) {
$this->foo = $foo;
}
}
$Foo = new Foo();
$Bar = new Bar();
$Foo->returnToTheBar($Bar);
PD9waHAKCmNsYXNzIEZvbyB7CglwdWJsaWMgZnVuY3Rpb24gcmV0dXJuVG9UaGVCYXIoQmFyICRiYXIpIHsKCQkkYmFyLT5nZXRGb28oJHRoaXMpOwoJfQp9CgpjbGFzcyBCYXIgewoJcHVibGljICRmb287CgkKCXB1YmxpYyBmdW5jdGlvbiBnZXRGb28oJGZvbykgewoJCSR0aGlzLT5mb28gPSAkZm9vOwoJfSAKfQoKCiRGb28gPSBuZXcgRm9vKCk7CiRCYXIgPSBuZXcgQmFyKCk7CgokRm9vLT5yZXR1cm5Ub1RoZUJhcigkQmFyKTsKCnZhcl9kdW1wKCRGb28pOwoKdmFyX2R1bXAoJEJhci0+Zm9vKTsK