<?php
class A {
var $aa = 1;
}
class B {
var $objA;
function setA(A $objA)
{
$this->objA = $objA;
}
}
$objA = new A;
$objB = new B();
$objB->setA($objA);
$objB->objA->aa = 666;
var_dump($objA, $objB);
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/WKhc4 on line 3
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/WKhc4 on line 7
object(A)#1 (1) {
["aa"]=>
int(666)
}
object(B)#2 (1) {
["objA"]=>
object(A)#1 (1) {
["aa"]=>
int(666)
}
}
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting ')' in /in/WKhc4 on line 9
Process exited with code 255.