3v4l.org

run code in 300+ PHP versions simultaneously
<?php class B { public function list() { return range('a', 'z'); } } $array = [new B, 'list']; var_dump($array());
Output for 7.1.25 - 7.1.30, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.30, 8.0.0 - 8.0.22, 8.1.0 - 8.1.9
array(26) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" [3]=> string(1) "d" [4]=> string(1) "e" [5]=> string(1) "f" [6]=> string(1) "g" [7]=> string(1) "h" [8]=> string(1) "i" [9]=> string(1) "j" [10]=> string(1) "k" [11]=> string(1) "l" [12]=> string(1) "m" [13]=> string(1) "n" [14]=> string(1) "o" [15]=> string(1) "p" [16]=> string(1) "q" [17]=> string(1) "r" [18]=> string(1) "s" [19]=> string(1) "t" [20]=> string(1) "u" [21]=> string(1) "v" [22]=> string(1) "w" [23]=> string(1) "x" [24]=> string(1) "y" [25]=> string(1) "z" }

preferences:
56.25 ms | 411 KiB | 5 Q