Here is my simple example:
Code printing variable of class which instatiates the printing class.
Well, I am sure you understand when looking at the code:
Print result is: jippii
<?php
class A {
function something() {
$s = debug_backtrace();
$callingObject = $s[1]['object'];
$test = $callingObject->jip;
print $test;
}
}
class B {
var $jip;
function execute() {
$a = new A();
$this->jip = "jippii";
$a->something();
}
}
$control = new B();
$control->execute();
?>