3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Testing { private $value = 0; public function incrementBy1() { $this->value ++; if (rand(1, 9)) { return null; } return $this; } public function output() { echo "value: " . $this->value; } } $test = new Testing; $test->incrementBy1()->incrementBy1()->incrementBy1()->output();

preferences:
33.8 ms | 402 KiB | 5 Q