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(Gender::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.0130.00318.30
8.3.50.0130.00522.06
8.3.40.0000.01518.54
8.3.30.0070.00718.72
8.3.20.0070.00020.21
8.3.10.0040.00422.09
8.3.00.0080.00022.27
8.2.180.0070.01018.29
8.2.170.0140.00022.96
8.2.160.0070.00720.77
8.2.150.0030.00524.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0090.00019.48
8.2.110.0110.00022.29
8.2.100.0060.00617.91
8.2.90.0040.00417.84
8.2.80.0040.00417.97
8.2.70.0050.00317.63
8.2.60.0050.00317.93
8.2.50.0000.00818.07
8.2.40.0040.00418.28
8.2.30.0040.00418.05
8.2.20.0040.00417.71
8.2.10.0070.00017.68
8.2.00.0000.00817.68
8.1.280.0090.00625.92
8.1.270.0050.00523.76
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0000.00922.46
8.1.230.0040.00720.95
8.1.220.0050.00317.74
8.1.210.0050.00318.91
8.1.200.0080.00317.35
8.1.190.0030.00617.39
8.1.180.0060.00318.10
8.1.170.0000.00818.41
8.1.160.0000.00822.02
8.1.150.0030.00518.63
8.1.140.0040.00417.40
8.1.130.0030.00317.87
8.1.120.0070.00017.46
8.1.110.0000.00817.41
8.1.100.0040.00417.38
8.1.90.0040.00417.36
8.1.80.0040.00317.34
8.1.70.0000.00717.40
8.1.60.0020.00517.46
8.1.50.0040.00417.45
8.1.40.0000.00817.56
8.1.30.0040.00417.60
8.1.20.0040.00417.54
8.1.10.0030.00517.59
8.1.00.0040.00417.42
8.0.300.0040.00420.03
8.0.290.0040.00417.18
8.0.280.0030.00318.44
8.0.270.0000.00817.21
8.0.260.0000.00716.85
8.0.250.0020.00516.96
8.0.240.0020.00516.94
8.0.230.0030.00316.84
8.0.220.0000.00716.89
8.0.210.0030.00316.89
8.0.200.0040.00417.02
8.0.190.0030.00616.83
8.0.180.0000.00716.94
8.0.170.0060.00316.95
8.0.160.0050.00216.77
8.0.150.0030.00316.94
8.0.140.0040.00416.73
8.0.130.0030.00313.31
8.0.120.0040.00416.75
8.0.110.0000.00716.87
8.0.100.0050.00316.92
8.0.90.0040.00416.85
8.0.80.0120.00916.84
8.0.70.0070.00016.79
8.0.60.0040.00416.74
8.0.50.0050.00316.95
8.0.30.0130.01317.07
8.0.20.0130.00717.40
8.0.10.0030.00517.08
8.0.00.0090.00816.84
7.4.330.0050.00015.05
7.4.320.0040.00416.42
7.4.300.0030.00316.39
7.4.290.0040.00416.59
7.4.280.0070.00016.49
7.4.270.0030.00316.52
7.4.260.0030.00316.59
7.4.250.0040.00416.56
7.4.240.0020.00516.59
7.4.230.0000.00716.25
7.4.220.0200.00316.62
7.4.210.0120.00616.50
7.4.200.0030.00316.51
7.4.190.0050.00216.77
7.4.160.0130.00616.40
7.4.150.0060.01217.40
7.4.140.0130.00917.86
7.4.130.0110.00916.49
7.4.120.0050.01116.62
7.4.110.0110.01116.40
7.4.100.0070.01016.70
7.4.90.0120.01216.47
7.4.80.0070.01119.39
7.4.70.0030.01316.41
7.4.60.0120.00916.38
7.4.50.0080.00016.55
7.4.40.0090.00622.77
7.4.30.0120.00416.57
7.4.10.0030.01714.83
7.4.00.0050.01414.91
7.3.330.0050.00013.31
7.3.320.0000.00613.43
7.3.310.0070.00016.21
7.3.300.0070.00016.32
7.3.290.0060.00716.32
7.3.280.0080.01016.33
7.3.270.0070.01017.40
7.3.260.0100.00616.33
7.3.250.0100.00716.46
7.3.240.0070.01416.30
7.3.230.0050.01116.39
7.3.210.0070.01116.43
7.3.200.0120.00619.39
7.3.190.0060.01316.50
7.3.180.0070.01116.59
7.3.170.0130.00316.40
7.3.160.0150.00916.30
7.3.130.0060.01314.60
7.3.120.0080.00814.99
7.3.110.0120.00614.64
7.3.100.0070.00714.85
7.3.90.0150.00014.86
7.3.80.0070.00315.11
7.3.70.0000.01114.91
7.3.60.0070.00414.91
7.3.50.0030.01314.63
7.3.40.0030.01214.93
7.3.30.0030.01014.66
7.3.20.0030.01016.87
7.3.10.0110.00016.39
7.3.00.0070.00716.63
7.2.330.0110.00716.76
7.2.320.0120.00916.68
7.2.310.0110.01116.73
7.2.300.0070.01016.79
7.2.290.0080.00816.74
7.2.260.0110.00715.14
7.2.250.0060.00815.20
7.2.240.0120.00315.07
7.2.230.0060.00914.98
7.2.220.0060.00315.35
7.2.210.0040.00814.93
7.2.200.0040.00714.79
7.2.190.0000.01815.19
7.2.180.0030.01315.09
7.2.170.0060.00614.94
7.2.160.0060.00314.99
7.2.150.0110.00016.64
7.2.140.0040.00916.59
7.2.130.0060.00617.09
7.2.120.0070.01016.97
7.2.110.0060.00616.82
7.2.100.0070.00717.02
7.2.90.0060.00916.82
7.2.80.0030.01217.02
7.2.70.0030.00616.82
7.2.60.0030.01016.76
7.2.50.0090.00616.72
7.2.40.0030.00717.07
7.2.30.0070.00716.85
7.2.20.0000.01217.04
7.2.10.0030.00716.84
7.2.00.0040.01018.14
7.1.330.0100.00715.76
7.1.320.0040.00415.83
7.1.310.0080.00415.80
7.1.300.0040.00715.80
7.1.290.0090.00615.88
7.1.280.0040.00815.59
7.1.270.0060.00615.76
7.1.260.0080.00416.06
7.1.250.0000.01115.63
7.1.240.0030.00615.91
7.1.230.0040.01115.91
7.1.220.0030.00516.05
7.1.210.0100.00315.54
7.1.200.0000.01515.70
7.1.190.0040.00415.95
7.1.180.0060.00915.54
7.1.170.0040.00415.89
7.1.160.0120.00015.75
7.1.150.0030.01215.68
7.1.140.0040.01115.97
7.1.130.0120.00315.88
7.1.120.0060.00815.71
7.1.110.0040.01115.84
7.1.100.0090.00417.13
7.1.90.0030.01015.90
7.1.80.0030.00616.01
7.1.70.0020.00916.40
7.1.60.0070.00817.80
7.1.50.0090.00816.47
7.1.40.0000.01115.94
7.1.30.0000.00815.60
7.1.20.0040.00715.86
7.1.10.0110.00015.72
7.1.00.0070.04619.18
7.0.330.0050.00315.53
7.0.320.0070.01015.25
7.0.310.0050.00315.39
7.0.300.0080.00815.34
7.0.290.0130.00015.47
7.0.280.0060.00315.54
7.0.270.0030.00515.62
7.0.260.0030.01015.14
7.0.250.0040.00415.23
7.0.240.0060.00615.40
7.0.230.0090.00415.49
7.0.220.0120.00315.43
7.0.210.0090.00415.40
7.0.200.0060.00815.97
7.0.190.0040.00815.52
7.0.180.0000.01115.41
7.0.170.0030.01215.29
7.0.160.0070.00715.46
7.0.150.0040.00715.41
7.0.140.0070.04018.71
7.0.130.0070.00415.63
7.0.120.0060.00315.60
7.0.110.0070.00715.35
7.0.100.0130.00315.54
7.0.90.0000.01315.29
7.0.80.0120.00015.32
7.0.70.0110.00415.58
7.0.60.0050.02517.52
7.0.50.0080.03816.66
7.0.40.0060.02416.70
7.0.30.0210.03516.94
7.0.20.0150.03316.91
7.0.10.0020.04816.85
7.0.00.0050.02516.58
5.6.400.0030.01014.10
5.6.390.0030.01014.47
5.6.380.0040.00814.41
5.6.370.0050.00514.72
5.6.360.0080.00814.11
5.6.350.0080.00814.16
5.6.340.0070.00713.98
5.6.330.0030.01214.32
5.6.320.0030.00814.32
5.6.310.0110.00714.41
5.6.300.0030.01014.58
5.6.290.0030.01314.52
5.6.280.0040.04117.72
5.6.270.0080.00814.22
5.6.260.0000.01014.22
5.6.250.0000.01014.25
5.6.240.0000.01514.39
5.6.230.0040.00714.32
5.6.220.0060.00914.32
5.6.210.0040.02217.42
5.6.200.0020.02616.14
5.6.190.0070.02317.30
5.6.180.1970.02417.32
5.6.170.0220.03917.46
5.6.160.0020.03817.45
5.6.150.0080.02116.37
5.6.140.0050.03016.17
5.6.130.0050.03916.29
5.6.120.0100.04117.69
5.6.110.0130.04317.72
5.6.100.0070.02217.56
5.6.90.0120.04217.69
5.6.80.0030.02817.41
5.6.70.0030.01214.06
5.6.60.0060.00314.22
5.6.50.0110.00414.27
5.6.40.0030.00914.17
5.6.30.0030.01314.44
5.6.20.0000.00914.09
5.6.10.0050.01014.36
5.6.00.0040.01114.27
5.5.380.0030.01314.48
5.5.370.0080.00314.28
5.5.360.0000.00814.66
5.5.350.0180.03717.41
5.5.340.0070.04316.23
5.5.330.0070.02717.36
5.5.320.0070.04017.23
5.5.310.0080.02617.43
5.5.300.0030.03016.15
5.5.290.0080.02316.04
5.5.280.0070.03717.55
5.5.270.0030.02917.55
5.5.260.0110.04317.39
5.5.250.0070.02117.51
5.5.240.0080.04117.33
5.5.230.0060.00314.39
5.5.220.0000.01214.39
5.5.210.0120.00314.20
5.5.200.0040.00714.33
5.5.190.0070.00714.19
5.5.180.0060.00614.29
5.5.170.0030.01014.38
5.5.160.0000.01714.41
5.5.150.0070.00714.29
5.5.140.0060.00914.09
5.5.130.0000.01114.43
5.5.120.0040.00414.23
5.5.110.0040.01113.82
5.5.100.0030.00614.33
5.5.90.0090.00614.07
5.5.80.0080.00414.28
5.5.70.0040.00813.95
5.5.60.0060.00914.26
5.5.50.0000.01414.13
5.5.40.0100.00014.27
5.5.30.0060.00314.37
5.5.20.0030.01014.51
5.5.10.0030.01013.76
5.5.00.0060.00614.28
5.4.450.0160.02615.18
5.4.440.0280.02315.07
5.4.430.0200.02415.15
5.4.420.0650.02215.29
5.4.410.0120.02715.10
5.4.400.0120.02214.95
5.4.390.0380.02814.95
5.4.380.0370.03214.75
5.4.370.0700.03014.92
5.4.360.0170.02814.71
5.4.350.0170.02814.70
5.4.340.0160.03114.74
5.4.330.0070.00310.79
5.4.320.0030.02411.65
5.4.310.0070.01911.66
5.4.300.0070.02011.61
5.4.290.0040.02311.70
5.4.280.0090.01811.43
5.4.270.0040.02011.41
5.4.260.0040.02311.61
5.4.250.0070.02011.67
5.4.240.0030.02311.53
5.4.230.0050.02711.53
5.4.220.0070.01611.54
5.4.210.0050.02211.67
5.4.200.0040.02111.65
5.4.190.0050.02111.56
5.4.180.0070.01911.40
5.4.170.0030.02511.43
5.4.160.0050.02611.50
5.4.150.0060.01811.55
5.4.140.0080.02111.46
5.4.130.0070.02411.35
5.4.120.0030.02011.37
5.4.110.0040.02411.42
5.4.100.0050.02911.35
5.4.90.0090.02611.56
5.4.80.0080.02411.31
5.4.70.0060.02711.44
5.4.60.0060.01711.44
5.4.50.0030.02211.40
5.4.40.0020.03011.40
5.4.30.0060.02511.46
5.4.20.0080.02611.36
5.4.10.0090.02211.46
5.4.00.0040.02911.21
5.3.290.0050.02311.65
5.3.280.0060.03211.49
5.3.270.0060.03011.40
5.3.260.0080.02911.52
5.3.250.0080.02911.49
5.3.240.0080.02611.47
5.3.230.0050.01911.45
5.3.220.0070.02111.46
5.3.210.0030.02511.49
5.3.200.0020.02411.45
5.3.190.0040.02011.51
5.3.180.0030.02211.40
5.3.170.0070.02111.55
5.3.160.0040.02611.40
5.3.150.0050.02211.57
5.3.140.0080.02111.54
5.3.130.0050.02211.51
5.3.120.0040.02011.36
5.3.110.0040.02511.51
5.3.100.0050.02111.30
5.3.90.0060.01811.25
5.3.80.0040.02211.13
5.3.70.0070.01911.19
5.3.60.0020.02411.18
5.3.50.0080.01911.14
5.3.40.0020.03011.13
5.3.30.0040.02311.11
5.3.20.0020.02310.89
5.3.10.0100.02010.92
5.3.00.0070.01910.89
5.2.170.0040.0319.18
5.2.160.0030.0319.18
5.2.150.0030.0329.18
5.2.140.0060.0289.18
5.2.130.0030.0309.14
5.2.120.0030.0299.14
5.2.110.0060.0279.15
5.2.100.0060.0279.15
5.2.90.0040.0299.14
5.2.80.0020.0329.14
5.2.70.0030.0319.13
5.2.60.0040.0309.09
5.2.50.0080.0299.06
5.2.40.0030.0359.04
5.2.30.0050.0379.01
5.2.20.0060.0379.01
5.2.10.0020.0388.92
5.2.00.0060.0378.77
5.1.60.0060.0298.06
5.1.50.0030.0268.06
5.1.40.0040.0248.04
5.1.30.0040.0338.38
5.1.20.0040.0288.42
5.1.10.0050.0308.14
5.1.00.0100.0238.14
5.0.50.0070.0256.61
5.0.40.0030.0286.48
5.0.30.0060.0316.29
5.0.20.0040.0206.26
5.0.10.0030.0216.24
5.0.00.0030.0316.23
4.4.90.0030.0204.78
4.4.80.0020.0164.75
4.4.70.0010.0174.75
4.4.60.0010.0184.76
4.4.50.0030.0154.77
4.4.40.0050.0304.70
4.4.30.0010.0194.76
4.4.20.0020.0184.84
4.4.10.0040.0174.85
4.4.00.0020.0264.76
4.3.110.0010.0174.67
4.3.100.0030.0144.66
4.3.90.0030.0144.63
4.3.80.0030.0254.58
4.3.70.0040.0134.63
4.3.60.0050.0124.63
4.3.50.0050.0194.63
4.3.40.0010.0254.54
4.3.30.0010.0173.27
4.3.20.0020.0163.25
4.3.10.0030.0153.22
4.3.00.0070.01715.11

preferences:
57 ms | 401 KiB | 5 Q