3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ColorGenerator { /** * Map of Material Design hex colors. * * @var array */ private static $map = [ 0xFF000000, // black 0xFFFFFFFF, // white 0xFFF44336, // red 0xFFE91E63, // pink 0xFF9C27B0, // purple 0xFF673AB7, // deep purple 0xFF3F51B5, // indigo 0xFF2196F3, // blue 0xFF03A9F4, // light blue 0xFF00BCD4, // cyan 0xFF009688, // teal 0xFF4CAF50, // green 0xFF8BC34A, // light green 0xFFCDDC39, // lime 0xFFFFEB3B, // yellow 0xFFFFC107, // amber 0xFFFF9800, // orange 0xFFFF5722, // deep orange 0xFF795548, // brown 0xFF9E9E9E, // grey 0xFF607D8B, // blue grey ]; public static function debug(): void { var_dump(self::$map); } /** * @return string */ public static function generate(): string { $size = count(self::$map); $random = mt_rand(0, ($size - 1)); $_color = self::$map[$random] ?? self::$map[0]; return dechex($_color); } } $color = ColorGenerator::generate(); ColorGenerator::debug(); var_dump($color);

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.0150.00314.95
7.3.110.0120.00314.96
7.3.100.0060.00814.77
7.3.90.0030.01014.98
7.3.80.0060.00914.96
7.3.70.0090.00914.94
7.3.60.0090.00614.82
7.3.50.0070.01014.82
7.3.40.0110.00414.89
7.3.30.0070.01014.73
7.3.20.0140.00316.57
7.3.10.0100.00716.44
7.3.00.0270.00716.46
7.2.240.0060.00614.99
7.2.230.0030.01315.22
7.2.220.0050.00514.88
7.2.210.0030.01415.16
7.2.200.0120.00614.84
7.2.190.0070.00714.98
7.2.180.0060.00915.00
7.2.170.0040.01415.11
7.2.160.0060.00915.05
7.2.150.0070.00716.77
7.2.140.0040.01216.95
7.2.130.0140.00416.61
7.2.120.0070.01116.85
7.2.110.0070.01016.49
7.2.100.0350.01015.76
7.2.90.0120.00815.76
7.2.80.0130.00615.70
7.2.70.0660.00715.94
7.2.60.0260.00815.97
7.2.50.2530.01116.03
7.2.40.0140.01015.81
7.2.30.0420.00915.99
7.2.20.0120.00915.72
7.2.10.2820.01115.88
7.2.00.2150.00815.83
7.1.330.0000.01315.75
7.1.320.0040.01215.84
7.1.310.0070.01015.77
7.1.300.0000.01615.55
7.1.290.0060.00615.76
7.1.280.0070.00715.56
7.1.270.0030.01215.71
7.1.260.0030.01315.72
7.1.250.0030.01015.71
7.1.210.0820.01013.42
7.1.200.0150.00613.50
7.1.190.3620.00313.85
7.1.180.2350.00613.63
7.1.170.0700.01313.99
7.1.160.1540.01013.74
7.1.150.0430.00313.82
7.1.140.0270.00713.70
7.1.130.4170.00713.65
7.1.120.5120.00613.81
7.1.110.4770.01013.88
7.1.100.3640.00613.76
7.1.90.3910.01313.90
7.1.80.3580.00713.98
7.1.70.3540.01013.89
7.1.60.3940.01031.60
7.1.50.5160.01031.74
7.1.40.5070.00331.77
7.1.30.6300.01031.72
7.1.20.5780.00731.69
7.1.10.4840.01313.77
7.1.00.4280.01313.46

preferences:
45.04 ms | 403 KiB | 5 Q