3v4l.org

run code in 300+ PHP versions simultaneously
<?php <?php interface Randomizer { public function randomize(); } class PHPRandRandomizer implements Randomizer { public function randomize() { return rand(1, 10); } } class LetterRandomizer implements Randomizer { private $letters = array('a','b','c','d','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'); public function randomize() { echo $this->letters[rand(1,24)]; } } class Matrix { private $randomizer; private $running = false; private $counter = 0; public function __construct(Randomizer $randomizer) { $this->randomizer = $randomizer; } public function start() { $this->running = true; $this->run(); } public function stop() { $this->running = false; } public function run() { while($this->running) { $this->counter++; // Alles in de console heel snel na elkaar uit echo'en om een matrix effect te creeƫren. echo $this->randomizer->randomize(); if ($this->counter > 50000000) { // De matrix stopt na een x aantal keren. $this->stop(); } } } } $matrix = new Matrix(new LetterRandomizer); // Hier gebruiken we een letter randomizer, maar je kan ook de PHPRandRandomizer gebruiken, met cijfertjes. $matrix->start();

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.5.30.0270.07019.44
5.5.20.0330.07019.28
5.5.10.0270.05319.45
5.5.00.0300.03719.48
5.4.190.0300.04318.86
5.4.180.0400.04719.14
5.4.170.0330.06718.86
5.4.160.0370.06318.83
5.4.150.0300.07019.22
5.4.140.0300.07316.46
5.4.130.0370.05716.32
5.4.120.0500.06316.26
5.4.110.0300.04316.44
5.4.100.0330.05316.34
5.4.90.0300.07016.28
5.4.80.0230.03716.38
5.4.70.0570.05316.41
5.4.60.0370.07016.39
5.4.50.0370.06316.46
5.4.40.0300.04016.35
5.4.30.0300.05716.50
5.4.20.0330.03716.47
5.4.10.0270.03316.64
5.4.00.0270.03715.90
5.3.270.0400.05314.54
5.3.260.0230.07714.50
5.3.250.0230.05014.55
5.3.240.0300.06714.69
5.3.230.0330.06314.57
5.3.220.0330.07314.55
5.3.210.0300.06014.49
5.3.200.0300.06714.47
5.3.190.0300.07014.52
5.3.180.0300.05014.51
5.3.170.0300.05014.54
5.3.160.0270.04714.50
5.3.150.0300.03714.52
5.3.140.0300.04714.39
5.3.130.0300.05314.47
5.3.120.0230.05014.45
5.3.110.0270.03714.47
5.3.100.0200.04713.98
5.3.90.0230.04313.99
5.3.80.0270.04713.99
5.3.70.0330.06313.95
5.3.60.0230.03713.93
5.3.50.0300.03013.88
5.3.40.0270.03713.92
5.3.30.0330.06713.87
5.3.20.0430.05313.84
5.3.10.0330.06013.84
5.3.00.0300.05013.84

preferences:
142.27 ms | 1398 KiB | 7 Q