3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class EmailInserter { protected $emails = array(); public static function printLinks($emails, $int = 1){ if($int > count($emails)){ // Fallback on max $int = count($emails); } $output = ''; while($int--){ $rand = rand(0, count($emails) - 1); $email = $emails[$rand]; unset($emails[$rand]); $emails = array_values($emails); $output .= '<a href="mailto:' . $email . '">' . $email . '</a>' . "\n"; } echo $output; } } class FooEmailInserter extends EmailInserter{ private static $locals = array( "SandieCapone", "KrystleKittinger", "AnnettaOno", "FridaFlagg", "ShirelyCacho", "MercyScarpa", "BurmaMask", "MatthewWarfel", "MyraCoad", "ReneePietz", ); private static $domains = array("gmail", "yahoo"); public static function init($int = 4, $print = true){ $emails = array(); foreach(self::$locals as $local){ foreach(self::$domains as $domain){ $emails[] = "$local@$domain.com"; } } if($print){ self::printLinks($emails, $int); } return $emails; } public function __construct($int = NULL){ $print = $int ? true : false; $this->emails = self::init($int, $print); } public function print($int){ self::printLinks($this->emails, $int); } } $foo = new FooEmailInserter(); $foo->print(10); FooEmailInserter::init();

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.120.0080.00815.06
7.3.110.0000.01114.91
7.3.100.0040.01114.97
7.3.90.0000.01414.89
7.3.80.0070.00714.59
7.3.70.0030.01314.62
7.3.60.0060.00614.86
7.3.50.0100.00714.65
7.3.40.0030.00714.56
7.3.30.0100.00314.94
7.3.20.0030.01016.72
7.3.10.0070.00616.74
7.3.00.0060.00616.79
7.2.240.0030.01015.05
7.2.230.0040.00715.09
7.2.220.0070.01015.01
7.2.210.0000.01714.99
7.2.200.0040.01415.21
7.2.190.0040.01515.23
7.2.180.0140.00315.18
7.2.170.0040.01115.12
7.2.160.0030.01315.02
7.2.150.0100.00717.00
7.2.140.0090.00617.01
7.2.130.0100.00516.73
7.2.120.0070.00917.07
7.2.110.0080.00616.86
7.2.100.0080.00516.88
7.2.90.0080.00717.02
7.2.80.0120.00317.03
7.2.70.0100.00617.14
7.2.60.0050.00916.91
7.2.50.0080.00917.09
7.2.40.0060.01117.05
7.2.30.0030.01116.91
7.2.20.0050.00717.02
7.2.10.0050.01016.94
7.2.00.0050.00917.90
7.1.330.0060.00315.91
7.1.320.0030.01316.05
7.1.310.0030.01415.82
7.1.300.0080.00815.70
7.1.290.0030.01415.84
7.1.280.0080.00815.88
7.1.270.0080.00815.58
7.1.260.0000.01515.94
7.1.250.0080.00615.77
7.1.70.0030.00617.01
7.1.60.0100.01419.40
7.1.50.0230.01034.56
7.1.00.0000.08022.44
7.0.200.0000.01016.80
7.0.60.0170.05321.63
7.0.50.0130.07317.85
7.0.40.0130.07720.10
7.0.30.0270.04320.19
7.0.20.0370.08320.24
7.0.10.0130.08320.24
7.0.00.0170.08020.23
5.6.280.0000.05021.09
5.6.210.0170.07320.66
5.6.200.0100.08318.18
5.6.190.0070.07720.50
5.6.180.0300.08020.48
5.6.170.0530.06720.44
5.6.160.0030.06720.48
5.6.150.0100.08318.18
5.6.140.0100.03318.16
5.6.130.0100.06318.18
5.6.120.0200.07021.13
5.6.110.0200.07720.99
5.6.100.0170.07320.99
5.6.90.0070.08321.12
5.6.80.0030.04020.39
5.5.350.0300.07020.40
5.5.340.0170.07017.98
5.5.330.0100.04020.27
5.5.320.0630.06720.27
5.5.310.0230.06020.37
5.5.300.0070.04017.98
5.5.290.0130.03317.99
5.5.280.0000.06720.79
5.5.270.0070.03720.77
5.5.260.0030.04320.77
5.5.250.0030.04020.57
5.5.240.0330.06720.17

preferences:
38.23 ms | 401 KiB | 5 Q