3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Something { public function one(): int { global $number; if ($number === null) $number = 1; return $number; } public function two(): int { global $number; if ($number === null) $number = 2; return $number; } } $s = new Something(); var_dump($s->one()); var_dump($s->two());

preferences:
14.88 ms | 458 KiB | 5 Q