3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait Randoz{ public function between0And10():int { return rand(0,10); } } interface RndCounter { function randomInt():int; function between0And10():int; } function create(): RndCounter { return new class() implements RndCounter { use Randoz; function randomInt():int { return rand(); } }; } $counter = create(); echo $counter->randomInt()." - ".$counter->between0And10();
Output for 8.1.8
1502896627 - 6
Output for 8.1.7
1273606867 - 3
Output for 8.1.6
1120270153 - 8
Output for 8.1.5
1831228203 - 10
Output for 8.1.4
995732723 - 8
Output for 8.1.3
1764852746 - 4
Output for 8.1.2
893726671 - 8
Output for 8.1.1
819642020 - 0
Output for 8.1.0
1411930385 - 3
Output for 8.0.21
2146842903 - 5
Output for 8.0.20
71379410 - 0
Output for 8.0.19
1305966218 - 4
Output for 8.0.18
1824787571 - 4
Output for 8.0.17
2122509920 - 4
Output for 8.0.16
2081857490 - 1
Output for 8.0.15
723689151 - 8
Output for 8.0.14
192811168 - 9
Output for 8.0.13
2122978937 - 4
Output for 8.0.12
1887172646 - 4
Output for 8.0.11
774698399 - 0
Output for 8.0.10
41185743 - 1
Output for 8.0.9
364062300 - 3
Output for 8.0.8
636195035 - 0
Output for 8.0.7
31148491 - 7
Output for 8.0.6
96325371 - 8
Output for 8.0.5
919541859 - 2
Output for 8.0.3
1292315487 - 2
Output for 8.0.2
382358656 - 8
Output for 8.0.1
532656884 - 5
Output for 7.4.30
824184690 - 7
Output for 7.4.29
1215080937 - 3
Output for 7.4.28
53071908 - 3
Output for 7.4.27
1607361381 - 5
Output for 7.4.26
2133282243 - 9
Output for 7.4.25
1101927361 - 7
Output for 7.4.24
1366271861 - 8
Output for 7.4.23
1457317551 - 0
Output for 7.4.22
191823998 - 1
Output for 7.4.21
1437457443 - 5
Output for 7.4.20
1742660109 - 9
Output for 7.4.19
280654812 - 9
Output for 7.4.18
1381344529 - 5
Output for 7.4.16
2128616739 - 2
Output for 7.4.15
974699172 - 0
Output for 7.4.14
574985608 - 5
Output for 7.4.13
314309438 - 3
Output for 7.4.12
1302376243 - 10
Output for 7.4.11
1430014652 - 1
Output for 7.4.10
1287791380 - 6
Output for 7.4.9
2140544251 - 1
Output for 7.4.8
1638329423 - 4
Output for 7.4.7
906006767 - 9
Output for 7.4.6
1496760362 - 1
Output for 7.4.5
672651141 - 10
Output for 7.4.4
1928829558 - 5
Output for 7.4.3
2140279824 - 5
Output for 7.4.2
702966392 - 0
Output for 7.4.1
1729483599 - 1
Output for 7.4.0
1121922998 - 5

preferences:
34.38 ms | 487 KiB | 5 Q