Comment accéder aux propriétés de la classe A à partir d'un objet instancié dans la classe A.Accès aux propriétés de classe
Comme ceci;
class A()
public var1;
public obj1;
function __construct(){
$this->var1 = 'Hello World';
$this->obj1 = new B();
}
==============
class B()
function anything(){
#i want to access var1 from the calling class here ????
# how do i access var1 in the calling class
}
* (référence) * [classes et les objets - Notions de base] (http://de2.php.net/manual/en/language.oop5.basic.php) – Gordon
* (lié) * [Learning OOP] (http://stackoverflow.com/search?q=learning+oop+php) – Gordon
duplication possible de [Trouver quelle classe a appelé une méthode dans une autre classe.] (http: // stackoverflow .com/questions/1214043/find-out-quelle-class-called-a-method-in-another-class) – Gordon