3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getcost($days){ $array=['base' => 100, 'for_2nd' => 70, 'after_2nd' => 50]; if($days==1){ $cost = $array['base'] * $days; }else if($days>=2){ $cost = $array['base'] + ($days == 2 ? $array['for_2nd'] : $array['for_2nd'] + ($days - 2) * $array['after_2nd']); } return $cost.'$'; } echo getcost(1); // it show 100$ echo getcost(2); // it show 170$ echo getcost(3); // it show 220$ echo getcost(4); // it show 270$ echo getcost(5); // it show 320$

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.70.0090.00916.75
8.3.60.0170.00016.50
8.3.50.0110.01416.40
8.3.40.0070.00718.84
8.3.30.0070.00718.85
8.3.20.0040.00421.77
8.3.10.0070.00023.48
8.3.00.0060.00320.78
8.2.190.0090.00916.63
8.2.180.0070.01116.32
8.2.170.0110.00322.96
8.2.160.0070.00722.25
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0080.00019.11
8.2.120.0050.00226.35
8.2.110.0100.00020.88
8.2.100.0120.00018.03
8.2.90.0030.00620.64
8.2.80.0040.00417.97
8.2.70.0070.00317.80
8.2.60.0000.00818.11
8.2.50.0050.00318.10
8.2.40.0040.00421.03
8.2.30.0040.00419.30
8.2.20.0070.00018.10
8.2.10.0040.00419.18
8.2.00.0000.00719.17
8.1.280.0040.01125.92
8.1.270.0030.00622.12
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0080.00320.76
8.1.230.0110.00021.04
8.1.220.0050.00317.79
8.1.210.0070.00318.91
8.1.200.0030.00617.35
8.1.190.0050.00317.23
8.1.180.0040.00418.10
8.1.170.0000.00818.54
8.1.160.0070.00018.74
8.1.150.0040.00418.88
8.1.140.0070.00022.09
8.1.130.0060.00320.05
8.1.120.0030.00317.40
8.1.110.0070.00017.35
8.1.100.0030.00617.40
8.1.90.0060.00317.35
8.1.80.0000.00717.46
8.1.70.0070.00017.41
8.1.60.0050.00317.65
8.1.50.0000.00817.45
8.1.40.0030.00617.49
8.1.30.0070.00017.62
8.1.20.0000.00717.68
8.1.10.0040.00417.51
8.1.00.0040.00417.53
8.0.300.0070.00019.85
8.0.290.0000.00816.75
8.0.280.0000.00718.38
8.0.270.0000.00717.25
8.0.260.0050.00318.43
8.0.250.0000.00716.88
8.0.240.0000.00716.88
8.0.230.0040.00416.88
8.0.220.0070.00216.80
8.0.210.0040.00416.87
8.0.200.0000.00716.79
8.0.190.0000.00716.95
8.0.180.0000.00816.95
8.0.170.0090.00016.94
8.0.160.0000.00816.84
8.0.150.0040.00416.73
8.0.140.0000.00716.84
8.0.130.0000.00613.33
8.0.120.0070.00016.74
8.0.110.0040.00416.78
8.0.100.0000.00916.91
8.0.90.0050.00216.95
8.0.80.0080.00916.93
8.0.70.0000.00816.88
8.0.60.0040.00416.92
8.0.50.0040.00416.77
8.0.30.0120.00617.18
8.0.20.0060.01317.30
8.0.10.0050.00217.02
8.0.00.0110.00916.79
7.4.330.0000.00615.55
7.4.320.0030.00316.52
7.4.300.0070.00016.41
7.4.290.0040.00416.55
7.4.280.0060.00316.44
7.4.270.0030.00316.46
7.4.260.0040.00416.45
7.4.250.0030.00316.61
7.4.240.0040.00416.59
7.4.230.0030.00316.68
7.4.220.0040.00416.63
7.4.210.0070.00816.66
7.4.200.0040.00316.63
7.4.160.0080.00816.51
7.4.140.0100.00717.86
7.4.130.0100.01016.65
7.4.120.0060.01416.55
7.4.110.0100.00716.70
7.4.100.0160.00716.51
7.4.90.0120.01016.56
7.4.80.0110.00719.39
7.4.70.0090.00916.29
7.4.60.0030.01416.63
7.4.50.0090.00616.29
7.4.40.0100.00616.62
7.4.10.0090.00614.91
7.4.00.0110.00714.98
7.3.330.0020.00213.19
7.3.320.0060.00013.36
7.3.310.0070.00016.26
7.3.300.0040.00416.38
7.3.290.0070.00016.17
7.3.280.0110.00516.34
7.3.260.0100.01016.46
7.3.240.0060.01516.52
7.3.230.0000.01716.33
7.3.210.0120.00416.42
7.3.200.0120.00416.27
7.3.190.0090.00916.36
7.3.180.0100.01016.40
7.3.170.0000.01716.34
7.3.160.0140.00416.43
7.3.130.0030.01314.44
7.3.120.0040.01314.90
7.3.110.0070.00914.94
7.3.100.0050.01014.88
7.3.90.0090.00714.74
7.3.80.0040.00814.95
7.3.70.0060.00814.75
7.3.60.0070.00514.72
7.3.50.0040.00914.75
7.3.40.0040.00914.86
7.3.30.0080.00814.89
7.3.20.0040.00816.64
7.3.10.0060.00716.71
7.3.00.0150.00716.25
7.2.330.0060.01216.60
7.2.320.0090.01316.41
7.2.310.0110.00516.75
7.2.300.0060.00916.36
7.2.290.0160.00016.94
7.2.260.0140.00414.98
7.2.250.0040.01115.07
7.2.240.0060.01114.98
7.2.230.0090.00615.04
7.2.220.0030.01315.19
7.2.210.0060.00815.12
7.2.200.0060.00715.11
7.2.190.0020.01115.15
7.2.180.0040.00915.12
7.2.170.0070.00615.09
7.2.160.0080.00715.03
7.2.150.0080.00616.94
7.2.140.0060.00817.00
7.2.130.0190.00716.30
7.2.120.0150.00516.41
7.2.110.0140.00716.34
7.2.100.0140.00716.48
7.2.90.0140.00916.45
7.2.80.0130.00916.52
7.2.70.0170.00716.42
7.2.60.0160.00716.39
7.2.50.0150.00916.37
7.2.40.0130.00616.51
7.2.30.0160.00716.44
7.2.20.0120.01016.42
7.2.10.0120.00816.43
7.2.00.0140.00916.60
7.1.330.0060.00915.79
7.1.320.0070.00615.81
7.1.310.0050.00915.89
7.1.300.0080.00515.81
7.1.290.0050.00915.67
7.1.280.0050.00615.67
7.1.270.0070.00715.70
7.1.260.0070.00615.87
7.1.250.0140.00615.25
7.1.240.0090.00015.55
7.1.230.0000.01115.68
7.1.220.0070.01015.61
7.1.210.0080.00415.98
7.1.200.0070.01015.85
7.1.190.0040.00815.79
7.1.180.0000.01015.92
7.1.170.0130.00015.86
7.1.160.0090.00616.02
7.1.150.0000.01215.72
7.1.140.0110.00015.90
7.1.130.0040.01115.55
7.1.120.0110.00415.68
7.1.110.0060.00315.95
7.1.100.0120.00015.63
7.1.90.0110.00415.91
7.1.80.0030.00715.71
7.1.70.0090.00315.76
7.1.60.0060.00915.49
7.1.50.0040.01415.71
7.1.40.0050.00515.93
7.1.30.0070.00715.80
7.1.20.0050.00515.73
7.1.10.0030.01015.78
7.1.00.0100.00315.61
7.0.330.0030.00715.27
7.0.320.0030.01015.68
7.0.310.0000.01015.60
7.0.300.0070.00315.41
7.0.290.0090.00615.18
7.0.280.0000.01615.35
7.0.270.0060.00615.42
7.0.260.0130.00015.56
7.0.250.0030.01015.43
7.0.240.0070.00715.50
7.0.230.0030.00715.57
7.0.220.0000.01315.21
7.0.210.0030.00915.43
7.0.200.0030.01015.36
7.0.190.0030.01415.57
7.0.180.0030.01015.47
7.0.170.0110.00315.48
7.0.160.0080.00415.48
7.0.150.0060.00615.39
7.0.140.0060.01015.40
7.0.130.0000.01015.54
7.0.120.0060.00815.33
7.0.110.0000.00915.54
7.0.100.0080.00415.61
7.0.90.0000.01115.54
7.0.80.0080.00615.33
7.0.70.0000.01215.51
7.0.60.0030.01315.48
7.0.50.0030.01315.45
7.0.40.0040.01113.56
7.0.30.0060.00613.58
7.0.20.0000.01313.52
7.0.10.0060.00313.52
7.0.00.0040.00813.54

preferences:
58.31 ms | 401 KiB | 5 Q