3v4l.org

run code in 300+ PHP versions simultaneously
<?php class myClass { private $arr = ["rose" => "red", "violet" => "blue", "grass" => "green"]; function getArrVal($elem){ return $this->arr[$elem]; } } $obj = new myClass; $flowers = [0=>"rose",1=>"violet"]; $closure = function( $item ){ return $this->getArrVal( $item ); }; foreach ($flowers as $key => $flower){ $color = $closure->call($obj,$flower); echo ucfirst("{$flower}s are $color"); echo ($key == 0)? ",\n" : " ...\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)
8.3.60.0000.01516.37
8.3.50.0150.00017.89
8.3.40.0120.00318.85
8.3.30.0040.01118.59
8.3.20.0040.00420.34
8.3.10.0030.00718.77
8.3.00.0040.00423.65
8.2.180.0140.00716.75
8.2.170.0120.00322.96
8.2.160.0000.01422.17
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0030.00520.63
8.2.120.0040.00426.35
8.2.110.0030.00620.49
8.2.100.0090.00318.16
8.2.90.0040.00419.36
8.2.80.0040.00417.97
8.2.70.0070.00317.63
8.2.60.0080.00017.80
8.2.50.0000.01118.09
8.2.40.0040.00422.13
8.2.30.0070.00019.38
8.2.20.0040.00417.62
8.2.10.0040.00418.06
8.2.00.0000.00717.99
8.1.280.0040.01125.92
8.1.270.0030.00622.07
8.1.260.0050.00328.09
8.1.250.0040.00428.09
8.1.240.0030.00623.88
8.1.230.0110.00017.72
8.1.220.0040.00417.78
8.1.210.0000.00818.77
8.1.200.0070.00317.13
8.1.190.0030.00517.35
8.1.180.0040.00418.10
8.1.170.0000.00818.59
8.1.160.0070.00020.76
8.1.150.0070.00418.80
8.1.140.0040.00419.47
8.1.130.0030.00317.76
8.1.120.0000.00817.47
8.1.110.0000.00817.38
8.1.100.0040.00417.46
8.1.90.0000.00717.51
8.1.80.0000.00817.36
8.1.70.0000.00717.45
8.1.60.0050.00217.47
8.1.50.0030.00617.40
8.1.40.0000.00817.52
8.1.30.0080.00017.64
8.1.20.0040.00417.54
8.1.10.0000.00817.52
8.1.00.0030.00617.55
8.0.300.0040.00418.77
8.0.290.0080.00016.75
8.0.280.0030.00318.41
8.0.270.0000.00717.16
8.0.260.0030.00317.23
8.0.250.0040.00416.95
8.0.240.0030.00316.93
8.0.230.0030.00316.86
8.0.220.0060.00316.73
8.0.210.0040.00416.77
8.0.200.0000.00616.93
8.0.190.0030.00316.91
8.0.180.0000.00716.93
8.0.170.0000.00716.76
8.0.160.0000.00716.93
8.0.150.0040.00416.78
8.0.140.0040.00716.63
8.0.130.0000.00513.30
8.0.120.0080.00016.82
8.0.110.0070.00016.88
8.0.100.0040.00416.79
8.0.90.0040.00416.72
8.0.80.0000.01716.93
8.0.70.0000.00816.84
8.0.60.0070.00016.66
8.0.50.0040.00416.89
8.0.30.0120.00717.27
8.0.20.0090.00917.40
8.0.10.0000.00717.00
8.0.00.0090.01016.80
7.4.330.0020.00216.79
7.4.320.0030.00316.59
7.4.300.0050.00316.48
7.4.290.0020.00516.35
7.4.280.0000.00716.61
7.4.270.0040.00416.42
7.4.260.0030.00316.50
7.4.250.0030.00316.56
7.4.240.0000.00816.52
7.4.230.0000.00716.31
7.4.220.0090.00916.46
7.4.210.0030.01016.63
7.4.200.0000.00716.39
7.4.160.0070.01016.54
7.4.150.0100.00717.40
7.4.140.0130.00617.86
7.4.130.0090.00916.41
7.4.120.0150.00316.49
7.4.110.0090.00616.38
7.4.100.0060.01016.50
7.4.90.0070.01016.39
7.4.80.0130.01019.39
7.4.70.0040.01316.66
7.4.60.0120.01116.41
7.4.50.0040.00816.72
7.4.40.0100.01016.51
7.4.30.0140.00416.32
7.4.10.0120.00616.52
7.4.00.0070.00715.70
7.3.330.0050.00013.36
7.3.320.0030.00313.31
7.3.310.0000.00716.17
7.3.300.0000.00816.23
7.3.290.0110.00816.37
7.3.280.0090.00916.33
7.3.270.0160.00017.40
7.3.260.0140.00716.54
7.3.250.0120.00916.35
7.3.240.0120.00816.35
7.3.230.0120.00616.63
7.3.210.0060.01316.54
7.3.200.0030.01419.39
7.3.190.0120.00316.41
7.3.180.0160.00316.48
7.3.170.0060.01116.27
7.3.160.0110.00416.21
7.3.130.0060.00816.41
7.3.120.0070.00815.52
7.3.110.0080.00715.66
7.3.100.0080.00815.53
7.3.90.0080.00515.60
7.3.80.0020.01215.73
7.3.70.0080.00815.51
7.3.60.0040.00715.60
7.3.50.0030.00715.57
7.3.40.0040.00815.52
7.3.30.0090.00315.58
7.3.20.0080.00717.40
7.3.10.0060.00717.21
7.3.00.0040.00917.01
7.2.330.0100.00716.80
7.2.320.0120.00616.55
7.2.310.0110.01116.55
7.2.300.0070.01416.36
7.2.290.0100.00716.84
7.2.260.0100.01016.36
7.2.250.0070.01416.67
7.2.240.0080.00915.82
7.2.230.0060.00815.87
7.2.220.0040.01115.74
7.2.210.0030.01415.73
7.2.200.0070.00715.62
7.2.190.0070.00715.86
7.2.180.0020.01215.72
7.2.170.0080.00815.80
7.2.160.0050.01115.78
7.2.150.0060.01117.70
7.2.140.0080.00417.85
7.2.130.0050.01017.27
7.2.120.0070.00817.39
7.2.110.0020.01117.37
7.2.100.0060.00817.38
7.2.90.0060.00817.56
7.2.80.0040.01017.40
7.2.70.0050.00717.36
7.2.60.0060.00717.14
7.2.50.0110.00317.27
7.2.40.0070.00817.44
7.2.30.0100.00517.38
7.2.20.0070.00517.34
7.2.10.0040.01017.49
7.2.00.0040.00917.85
7.1.330.0020.01316.58
7.1.320.0030.01416.49
7.1.310.0050.01016.61
7.1.300.0070.00516.60
7.1.290.0070.00816.64
7.1.280.0020.01116.56
7.1.270.0040.00816.66
7.1.260.0060.00816.57
7.1.250.0030.00916.21
7.1.240.0060.00617.27
7.1.230.0070.00317.30
7.1.220.0030.01017.33
7.1.210.0100.00317.24
7.1.200.0050.01116.58
7.1.190.0060.00617.19
7.1.180.0070.00417.29
7.1.170.0070.00717.33
7.1.160.0060.00917.30
7.1.150.0060.00617.20
7.1.140.0040.00417.39
7.1.130.0030.01017.32
7.1.120.0040.01117.25
7.1.110.0040.00717.18
7.1.100.0020.00817.81
7.1.90.0100.00617.27
7.1.80.0060.00917.32
7.1.70.0030.00817.26
7.1.60.0050.01418.33
7.1.50.0070.01217.09
7.1.40.0090.00617.37
7.1.30.0110.00717.31
7.1.20.0030.01317.37
7.1.10.0100.00317.56
7.1.00.0100.03919.82
7.0.330.0060.00317.04
7.0.320.0080.00416.73
7.0.310.0070.01016.75
7.0.300.0000.01217.05
7.0.290.0100.00316.86
7.0.280.0040.00416.95
7.0.270.0060.00617.05
7.0.260.0000.01117.09
7.0.250.0030.01017.12
7.0.240.0070.00716.90
7.0.230.0100.00716.91
7.0.220.0030.00616.84
7.0.210.0080.00316.99
7.0.200.0120.00815.78
7.0.190.0030.01517.15
7.0.180.0060.00916.93
7.0.170.0040.00816.93
7.0.160.0100.00317.14
7.0.150.0060.01217.01
7.0.140.0130.00616.97
7.0.130.0060.00916.89
7.0.120.0030.01316.96
7.0.110.0150.00416.98
7.0.100.0090.00616.96
7.0.90.0090.00617.06
7.0.80.0030.01016.81
7.0.70.0060.00616.97
7.0.60.0120.04419.43
7.0.50.0020.04417.33
7.0.40.0050.03517.73
7.0.30.0130.02517.59
7.0.20.0230.04317.38
7.0.10.0050.02817.42
7.0.00.0060.04817.47
5.6.400.0050.00515.89
5.6.390.0070.01016.07
5.6.380.0030.00716.04
5.6.370.0060.00615.95
5.6.360.0070.00715.64
5.6.350.0090.01015.66
5.6.340.0110.00015.91
5.6.330.0080.00815.49
5.6.320.0060.00816.06
5.6.310.0060.00615.72
5.6.300.0090.00315.70
5.6.290.0070.01115.79
5.6.280.0100.03318.38
5.6.270.0070.00715.92
5.6.260.0100.01015.93
5.6.250.0040.01215.97
5.6.240.0100.00616.07
5.6.230.0030.00715.73
5.6.220.0070.01015.71
5.6.210.0030.04818.11
5.6.200.0070.04317.13
5.6.190.0000.04818.15
5.6.180.0150.03418.00
5.6.170.0110.02318.22
5.6.160.0080.02318.13
5.6.150.0090.03517.04
5.6.140.0070.04517.02
5.6.130.0020.03117.05
5.6.120.0120.03718.41
5.6.110.0050.02718.36
5.6.100.0070.04418.45
5.6.90.0120.02518.43
5.6.80.0080.03818.15
5.6.70.0070.01015.61
5.6.60.0060.01015.87
5.6.50.0000.01115.97
5.6.40.0070.01015.83
5.6.30.0000.01215.73
5.6.20.0110.00415.63
5.6.10.0030.00615.85
5.6.00.0000.01015.66
5.5.380.0150.00315.76
5.5.370.0110.00715.57
5.5.360.0110.01115.70
5.5.350.0100.04518.05
5.5.340.0110.02416.84
5.5.330.0070.04317.91
5.5.320.0250.03018.04
5.5.310.0230.02718.03
5.5.300.0140.02116.82
5.5.290.0110.04016.74
5.5.280.0110.04018.29
5.5.270.0070.02718.13
5.5.260.0100.02218.12
5.5.250.0050.03718.09
5.5.240.0270.03517.74
5.5.230.0040.01215.38
5.5.220.0030.01315.60
5.5.210.0090.00615.47
5.5.200.0180.00015.64
5.5.190.0000.01415.60
5.5.180.0040.01515.55
5.5.170.0040.00815.42
5.5.160.0060.00615.70
5.5.150.0030.01215.72
5.5.140.0090.00615.75
5.5.130.0030.00615.76
5.5.120.0100.00315.64
5.5.110.0100.00315.67
5.5.100.0030.01015.24
5.5.90.0110.00415.70
5.5.80.0100.00715.37
5.5.70.0120.00315.68
5.5.60.0070.00715.73
5.5.50.0030.00915.70
5.5.40.0030.00915.75
5.5.30.0070.01015.68
5.5.20.0060.00915.67
5.5.10.0000.01315.39
5.5.00.0090.00615.65

preferences:
40.28 ms | 401 KiB | 5 Q