3v4l.org

run code in 300+ PHP versions simultaneously
<?php class class1 { protected $prop; public function __construct($prop) { $this->prop = $prop; } public function getThing($arg) { assert('$arg->isValid();'); $this->prop->method(); } } class class2 { public function method() { echo "here\n"; } } class class3 { public function isValid() { return false; } } $tmp = new class1(new class2()); $tmp->getThing(new class3());

preferences:
35.26 ms | 407 KiB | 5 Q