- var_dump: documentation ( source)
<?php
class A {
private $consumer;
public function getConsumer()
{
var_dump(__METHOD__);
return $this->consumer;
}
public function setConsumer($val)
{
$this->consumer = $val;
}
}
class B extends A {
protected $consumer;
public function __construct($val)
{
$this->consumer = $val;
}
public function test()
{
var_dump(__METHOD__);
return $this->consumer;
}
}
var_dump("Construct B with 'B'");
$b = new B("B");
var_dump($b->test());
var_dump($b->getConsumer());
var_dump("B::setConsumer('A')");
$b->setConsumer("A");
var_dump($b->getConsumer());
var_dump($b->test());