3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Gender { const UNKNOWN = 0; const MALE = 1; const FEMALE = 2; const NOT_APPLICABLE = 9; public static function from($value) { static $names; if ( ! $names) { $class = new ReflectionClass(self::class); $constants = $class->getConstants(); $names = array_keys($constants); } foreach ($names as $name) { if (constant(__CLASS__ . '::' . $name) === $value) { return $name; } } throw new InvalidArgumentException('No matching gender for value ' . $value); } // no instances allowed private function __construct() {} } echo Gender::from(Gender::FEMALE); ?>

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)
8.3.60.0140.00718.06
8.3.50.0210.01021.88
8.3.40.0140.00418.67
8.3.30.0150.00718.79
8.3.20.0040.00420.35
8.3.10.0080.00022.08
8.3.00.0050.00322.43
8.2.180.0110.00416.75
8.2.170.0070.00722.96
8.2.160.0120.00620.80
8.2.150.0040.00424.18
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0060.00317.63
8.2.110.0000.00922.20
8.2.100.0000.01117.78
8.2.90.0080.00017.87
8.2.80.0070.00317.97
8.2.70.0050.00317.63
8.2.60.0090.00017.80
8.2.50.0060.00318.07
8.2.40.0040.00418.28
8.2.30.0000.00718.01
8.2.20.0000.00817.68
8.2.10.0040.00417.73
8.2.00.0040.00417.68
8.1.280.0120.00925.92
8.1.270.0060.00322.18
8.1.260.0000.00826.35
8.1.250.0110.00728.09
8.1.240.0100.00022.42
8.1.230.0090.00320.96
8.1.220.0040.00417.74
8.1.210.0040.00418.97
8.1.200.0070.00317.36
8.1.190.0050.00317.43
8.1.180.0040.00418.10
8.1.170.0080.00018.46
8.1.160.0070.00022.00
8.1.150.0040.00418.68
8.1.140.0040.00417.50
8.1.130.0070.00017.74
8.1.120.0040.00417.54
8.1.110.0040.00417.32
8.1.100.0040.00417.42
8.1.90.0000.00717.36
8.1.80.0030.00317.47
8.1.70.0070.00017.44
8.1.60.0050.00317.63
8.1.50.0040.00417.40
8.1.40.0040.00417.52
8.1.30.0050.00317.64
8.1.20.0080.00017.55
8.1.10.0000.00817.46
8.1.00.0040.00417.49
8.0.300.0050.00319.98
8.0.290.0080.00017.16
8.0.280.0050.00318.45
8.0.270.0000.00717.10
8.0.260.0030.00316.73
8.0.250.0050.00216.95
8.0.240.0070.00016.86
8.0.230.0050.00316.94
8.0.220.0070.00016.78
8.0.210.0030.00316.85
8.0.200.0070.00016.99
8.0.190.0040.00717.02
8.0.180.0040.00416.91
8.0.170.0030.00516.92
8.0.160.0000.00716.89
8.0.150.0000.00716.77
8.0.140.0000.00816.85
8.0.130.0000.00613.28
8.0.120.0000.00716.78
8.0.110.0000.00716.90
8.0.100.0040.00417.00
8.0.90.0040.00416.71
8.0.80.0150.00616.84
8.0.70.0030.00516.88
8.0.60.0050.00216.92
8.0.50.0070.00016.92
8.0.30.0100.01217.00
8.0.20.0060.01717.40
8.0.10.0040.00417.03
8.0.00.0140.00616.82
7.4.330.0000.00615.00
7.4.320.0040.00416.43
7.4.300.0030.00316.41
7.4.290.0000.00816.61
7.4.280.0070.00016.64
7.4.270.0040.00416.61
7.4.260.0040.00416.63
7.4.250.0040.00416.59
7.4.240.0040.00416.56
7.4.230.0030.00516.53
7.4.220.0100.00616.51
7.4.210.0050.01116.61
7.4.200.0030.00316.63
7.4.190.0050.00216.64
7.4.160.0100.01316.59
7.4.150.0140.00317.40
7.4.140.0120.01017.86
7.4.130.0100.00716.51
7.4.120.0130.00616.64
7.4.110.0100.00716.46
7.4.100.0170.00016.55
7.4.90.0030.01316.47
7.4.80.0120.00619.39
7.4.70.0030.02016.32
7.4.60.0090.00916.58
7.4.50.0040.00416.30
7.4.40.0060.01222.77
7.4.30.0040.01216.48
7.4.00.0090.00615.12
7.3.330.0030.00313.22
7.3.320.0030.00313.36
7.3.310.0070.00016.28
7.3.300.0070.00016.35
7.3.290.0070.00716.31
7.3.280.0050.01016.31
7.3.270.0180.00017.40
7.3.260.0000.01616.47
7.3.250.0080.00916.45
7.3.240.0090.01216.46
7.3.230.0060.01016.39
7.3.210.0070.01016.58
7.3.200.0150.00619.39
7.3.190.0080.01416.52
7.3.180.0110.00616.48
7.3.170.0080.00816.46
7.3.160.0130.01016.44
7.3.120.0080.00315.09
7.2.330.0090.00916.68
7.2.320.0100.01016.68
7.2.310.0170.00616.76
7.2.300.0120.00616.75
7.2.290.0030.01416.74
7.2.00.0030.01019.53
7.1.100.0030.00618.32
7.1.70.0000.01116.96
7.1.60.0070.00717.23
7.1.50.0170.00717.01
7.1.00.0100.08322.27
7.0.200.0030.01316.52
7.0.140.0070.07021.95
7.0.60.0130.08019.91
7.0.50.0130.07017.86
7.0.40.0030.06720.23
7.0.30.0270.05020.09
7.0.20.0300.07320.24
7.0.10.0300.07720.33
7.0.00.0070.08720.12
5.6.280.0030.07721.13
5.6.210.0100.07720.52
5.6.200.0130.08018.29
5.6.190.0100.03720.47
5.6.180.0000.09020.61
5.6.170.0330.06320.47
5.6.160.0130.05720.61
5.6.150.0000.06318.20
5.6.140.0030.05318.14
5.6.130.0000.05318.27
5.6.120.0030.06720.99
5.6.110.0100.08020.89
5.6.100.0070.08321.04
5.6.90.0170.06320.98
5.6.80.0070.08320.52
5.6.70.0330.05320.40
5.5.350.0000.03320.29
5.5.340.0100.08017.93
5.5.330.0030.04320.13
5.5.320.0400.07320.27
5.5.310.0100.06720.50
5.5.300.0070.04317.98
5.5.290.0100.08017.98
5.5.280.0000.04720.86
5.5.270.0130.03320.72
5.5.260.0000.04720.77
5.5.250.0070.07720.62
5.5.240.0070.07720.36
5.4.450.1800.04319.57
5.4.440.1800.04319.39
5.4.430.1830.04719.56
5.4.420.1800.04319.55
5.4.410.1900.03719.42
5.4.400.1800.04019.17
5.4.390.1770.04019.00
5.4.380.1570.04019.00
5.4.370.1700.04719.15
5.4.360.1830.04019.06
5.4.350.1800.04318.84
5.4.340.1670.04019.16
5.4.320.1730.05019.13
5.4.310.1730.04019.00
5.4.300.1570.03718.97
5.4.290.1730.04319.30
5.4.280.1770.03019.08
5.4.270.1730.03019.13
5.4.260.1770.03319.30
5.4.250.1670.03718.86
5.4.240.1630.03718.97
5.4.230.1600.04019.23
5.4.220.1630.03718.86
5.4.210.1630.03719.18
5.4.200.1730.02319.21
5.4.190.1600.04018.97
5.4.180.1670.03319.14
5.4.170.1930.04718.83
5.4.160.1830.05318.85
5.4.150.1630.04018.87
5.4.140.1570.04016.39
5.4.130.1800.05316.38
5.4.120.1630.03316.37
5.4.110.1830.04016.50
5.4.100.1830.04716.35
5.4.90.1830.03016.59
5.4.80.1830.04016.45
5.4.70.1630.03716.40
5.4.60.2000.03716.36
5.4.50.1900.04316.54
5.4.40.1700.03716.42
5.4.30.1670.04016.51
5.4.20.1730.04316.34
5.4.10.1530.03316.42
5.4.00.1500.03715.80
5.3.290.1770.04014.79
5.3.280.1870.04014.57
5.3.270.1730.04314.68
5.3.260.1600.04014.75
5.3.250.1830.04014.61
5.3.240.1770.04014.62
5.3.230.1700.03714.52
5.3.220.1800.04714.65
5.3.210.1700.03714.47
5.3.200.1900.03714.57
5.3.190.1830.04314.46
5.3.180.1870.04314.57
5.3.170.1830.03714.65
5.3.160.1530.04314.53
5.3.150.1830.04714.57
5.3.140.1870.04314.53
5.3.130.1730.03314.46
5.3.120.1930.04014.64
5.3.110.1900.03714.46
5.3.100.1930.04014.04
5.3.90.1900.04014.17
5.3.80.1730.03314.08
5.3.70.1670.03014.16
5.3.60.1930.03714.11
5.3.50.1670.03013.86
5.3.40.1970.04314.03
5.3.30.1630.03013.82
5.3.20.1730.02713.75
5.3.10.1600.03713.56
5.3.00.1800.03313.61
5.2.170.0730.03011.16
5.2.160.0070.02311.25
5.2.150.0030.04311.13
5.2.140.0400.03311.07
5.2.130.1170.02711.03
5.2.120.1370.03011.08
5.2.110.1100.03011.25
5.2.100.1230.02711.03
5.2.90.1370.03011.15
5.2.80.1400.02711.17
5.2.70.1470.03011.09
5.2.60.1330.02711.00
5.2.50.1400.02310.94
5.2.40.0630.03310.90
5.2.30.0870.03011.19
5.2.20.0900.03010.93
5.2.10.0870.02710.77
5.2.00.1030.02310.80
5.1.60.1200.03310.10
5.1.50.0700.03010.06
5.1.40.0030.0209.99
5.1.30.0030.02310.31
5.1.20.0030.02310.27
5.1.10.0270.02710.12
5.1.00.0830.03310.00
5.0.50.0370.0208.97
5.0.40.0500.0178.97
5.0.30.0370.0338.97
5.0.20.0530.0238.97
5.0.10.0430.0178.97
5.0.00.0470.0308.97
4.4.90.0470.0178.97
4.4.80.0530.0138.97
4.4.70.0530.0208.97
4.4.60.0300.0178.97
4.4.50.0530.0138.97
4.4.40.0300.0308.97
4.4.30.0430.0178.97
4.4.20.0500.0138.97
4.4.10.0530.0138.97
4.4.00.0470.0308.97
4.3.110.0500.0138.97
4.3.100.0400.0138.97
4.3.90.0270.0138.97
4.3.80.0430.0238.97
4.3.70.0500.0138.97
4.3.60.0500.0138.97
4.3.50.0470.0178.97
4.3.40.0600.0238.97
4.3.30.0230.0138.97
4.3.20.0270.0138.97
4.3.10.0270.0138.97
4.3.00.0270.0138.97

preferences:
41.74 ms | 401 KiB | 5 Q