3v4l.org

run code in 300+ PHP versions simultaneously
<?php class my_ite implements Iterator { public function current() { return 1; } public function key() { return 1; } public function next() { // do something. } public function rewind() { // do something. } public function valid() { return true; } }
Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.27, 8.4.1 - 8.4.14
Deprecated: Return type of my_ite::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/bPN2V on line 4 Deprecated: Return type of my_ite::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/bPN2V on line 10 Deprecated: Return type of my_ite::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/bPN2V on line 7 Deprecated: Return type of my_ite::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/bPN2V on line 16 Deprecated: Return type of my_ite::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/bPN2V on line 13
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30

preferences:
151.33 ms | 408 KiB | 5 Q