3v4l.org

run code in 300+ PHP versions simultaneously
<?php $adjectives = [ "Abaft", "Abandoned", "Abased", "Abashed", "Abasic", "Abbatial", "Abdicable", "Abdicant", "Abdicative", "Abdominal", "Abdominous", "Abducent", "Aberrant", "Aberrational", ]; $animals = [ "aardvark", "aardwolf", "abalone", "abyssiniancat", "abyssiniangroundhornbill", "acaciarat", "achillestang", "acornbarnacle", "acornweevil", "acornwoodpecker", "acouchi", "adamsstaghornedbeetle", "addax", "adder", ]; class AnimalIDs{ protected $adjectives = null; protected $animals = null; public function __construct($adjectives, $animals){ $this->adjectives = $adjectives; $this->animals = $animals; } public function get($adjectivesNum = 1,$format = 'dash'){ $result = ''; $delim = ''; for($n = 0; $n < $adjectivesNum; $n++){ if($format === 'dash'){ $result .= $delim . $this->adjectives[rand(0,count($this->adjectives) - 1)]; $delim = '-'; } } $result .= $delim . $this->animals[rand(0,count($this->animals) - 1)]; return $result; } } $a = new AnimalIDs($adjectives, $animals); echo $a->get()."\n"; echo $a->get(2)."\n";

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)
7.3.10.0060.01016.42
7.3.00.0080.00416.41
7.2.130.0040.01116.67
7.2.120.0090.00916.70
7.2.110.0100.00116.70
7.2.100.0080.01116.91
7.2.90.0060.00916.77
7.2.80.0110.00416.88
7.2.70.0360.00716.09
7.2.60.0390.00915.90
7.2.50.0330.00915.94
7.2.40.0310.00915.99
7.2.30.0290.01316.05
7.2.20.0420.00716.02
7.2.10.0350.00616.00
7.2.00.0350.00315.98
7.1.250.0060.00915.63
7.1.170.0680.00513.55
7.1.160.0670.01014.00
7.1.150.0610.01114.04
7.1.140.0760.00513.93
7.1.130.0630.00613.86
7.1.120.0670.00513.92
7.1.110.0680.00814.05
7.1.100.0860.01113.82
7.1.90.1290.00813.70
7.1.80.1180.01213.90
7.1.70.1020.00713.82
7.1.60.1080.01131.88
7.1.50.1410.00831.85
7.1.40.1550.00731.48
7.1.30.0780.01231.64
7.1.20.1030.01531.74
7.1.10.1280.01013.55
7.1.00.1000.00813.88

preferences:
34.66 ms | 401 KiB | 5 Q