- var_dump: documentation ( source)
<?php
class Car {
protected $speed = 0;
protected $people = 0;
public function onboardPerson() {
$this->people++;
}
public function accelerate() {
$this->speed++;
}
}
class Taxi extends Car {
protected $fare;
public function setFare($fare) {
$this->fare = $fare;
}
}
$taxi = new Taxi();
// Replace instances of type Car (T) with subtype Taxi (S)
$taxi->onboardPerson();
$taxi->accelerate();
var_dump($taxi);