Open ghost opened 11 years ago
class Foo{ private $foo=4; function __construct(){ echo $this->foo; } public function foo2(){ echo $this->foo; } } $f = new Foo(); $f->foo2();
alerted undefined,undefined
add to ClassExample.php test
.... private $privateFieldVal='foo'; public function privateField(){ return $this->privateFieldVal; }.... .... $value = $classExample->privateField(); assert($value, 'foo');
alerted undefined,undefined
add to ClassExample.php test