3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Manager { #[\NoDiscard] public function save(): int { return random_int(1, 8); } } $manager = new Manager(); // This should not be reported, see: // // https://www.php.net/manual/en/class.nodiscard.php (void) $manager->save(); // This is correctly reported if uncommented // $manager->save(); echo $manager->save();
Output for 8.5.3
4

preferences:
39.09 ms | 480 KiB | 4 Q