Need some help ant tips to understand and solve these case:
<?php class A { public $varA1; //type string public $varB; // type B function dispA(){ echo '$a->varA1 = '.$this->varA1.''; } } class B { public $varB1; // string public $varB2; // string function dispB(){ echo '$b->varB1 = '.$this->varB1.'
'; } } $b = new B(); $a = new A(); $a->varA1 = 'someA1'; $b->VarB1 = 'someB1'; $b->VarB2 = 'someB2'; $a->dispA(); $b->dispB(); //How to set up $a->varB? //This didnt work: //$a = new A( $b ); //$a->varB = new B(); //$a->varB1 = 'someAB1'; //There is function nedded to call witch takes argument of type A: //$result = foo( $a ); ?>
Tnx.