3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A implements Countable { private $count; public function __construct($count) { $this->count = $count; } public function count() { return $this->count; } } var_dump(empty(new A(-1))); var_dump(empty(new A( 0))); var_dump(empty(new A( 1)));
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Deprecated: Return type of A::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/T9QNd on line 11 bool(false) bool(false) bool(false)
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.21, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
bool(false) bool(false) bool(false)

preferences:
147.42 ms | 403 KiB | 198 Q