3v4l.org

run code in 300+ PHP versions simultaneously
<?php // create array of objects $arr = [new stdClass, new stdClass, new StdClass]; // assign properties for($i=0, $max=count($arr); $i < $max; $i++) { $arr[$i]->age = 0; $arr[$i]->creature = "squirrel"; } // update age values $arr[0]->age = 10; $arr[1]->age = 25; $arr[2]->age = 30; // recursively sum the ages of the array of objects ... function getTotalYears( $arr, $i, $carry ) { if ($i >= ( count( $arr ) - 1 ) ){ return $carry; } else { $carry += $arr[$i++]->age; getTotalYears( $arr, $i, $carry ); } } // .. and display result $total = getTotalYears( $arr, 0, 0); var_dump($total); echo "\nTotal years of nut foraging experience: $total";

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.0110.00418.43
8.3.50.0150.00618.39
8.3.40.0070.00718.79
8.3.30.0000.01418.79
8.3.20.0070.00020.16
8.3.10.0080.00020.98
8.3.00.0000.00720.96
8.2.180.0100.01018.41
8.2.170.0110.00322.96
8.2.160.0070.01419.22
8.2.150.0080.00024.18
8.2.140.0070.00024.66
8.2.130.0040.00419.27
8.2.120.0070.00026.35
8.2.110.0070.00320.34
8.2.100.0120.00317.84
8.2.90.0060.00319.22
8.2.80.0000.00718.03
8.2.70.0000.00817.63
8.2.60.0080.00017.80
8.2.50.0000.00818.10
8.2.40.0040.00420.24
8.2.30.0000.00719.32
8.2.20.0040.00418.05
8.2.10.0040.00418.14
8.2.00.0080.00018.09
8.1.280.0030.01225.92
8.1.270.0070.00022.14
8.1.260.0070.00026.35
8.1.250.0000.00728.09
8.1.240.0090.00022.61
8.1.230.0110.00019.16
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0050.00317.35
8.1.190.0040.00417.13
8.1.180.0040.00418.10
8.1.170.0000.00818.50
8.1.160.0000.00718.98
8.1.150.0050.00318.89
8.1.140.0050.00319.65
8.1.130.0070.00018.95
8.1.120.0070.00017.44
8.1.110.0030.00617.49
8.1.100.0080.00017.44
8.1.90.0040.00417.38
8.1.80.0000.00917.42
8.1.70.0030.00317.35
8.1.60.0000.00817.64
8.1.50.0040.00417.55
8.1.40.0040.00417.45
8.1.30.0030.00517.55
8.1.20.0080.00017.56
8.1.10.0040.00417.48
8.1.00.0080.00017.47
8.0.300.0040.00418.77
8.0.290.0000.00716.63
8.0.280.0000.00718.37
8.0.270.0030.00517.26
8.0.260.0000.00618.90
8.0.250.0030.00317.01
8.0.240.0030.00316.94
8.0.230.0000.00816.86
8.0.220.0040.00416.80
8.0.210.0040.00416.95
8.0.200.0030.00316.91
8.0.190.0000.00716.88
8.0.180.0050.00316.90
8.0.170.0040.00416.95
8.0.160.0030.00316.86
8.0.150.0040.00416.87
8.0.140.0040.00416.89
8.0.130.0000.00513.32
8.0.120.0000.00816.70
8.0.110.0070.00016.77
8.0.100.0040.00416.77
8.0.90.0000.00716.72
8.0.80.0130.00716.88
8.0.70.0000.00816.79
8.0.60.0000.00816.96
8.0.50.0000.00716.70
8.0.30.0090.00916.98
8.0.20.0070.01217.40
8.0.10.0000.00716.92
8.0.00.0030.01416.85
7.4.330.0030.00315.55
7.4.320.0030.00316.52
7.4.300.0060.00016.52
7.4.290.0000.00716.49
7.4.280.0040.00416.60
7.4.270.0000.00716.54
7.4.260.0000.00716.49
7.4.250.0030.00316.57
7.4.240.0000.00716.60
7.4.230.0030.00316.64
7.4.220.0040.01316.54
7.4.210.0110.00916.68
7.4.200.0000.00716.26
7.4.160.0090.00716.51
7.4.150.0120.00817.40
7.4.140.0080.01117.86
7.4.130.0160.00716.45
7.4.120.0120.00616.53
7.4.110.0130.00316.52
7.4.100.0090.01216.50
7.4.90.0110.00716.48
7.4.80.0110.01119.39
7.4.70.0160.00016.45
7.4.60.0030.01416.66
7.4.50.0040.00916.30
7.4.40.0090.00616.50
7.4.30.0090.01516.55
7.4.00.0030.01314.88
7.3.330.0030.00313.21
7.3.320.0000.00513.37
7.3.310.0080.00016.37
7.3.300.0030.00316.23
7.3.290.0120.00416.35
7.3.280.0050.01116.38
7.3.270.0140.00317.40
7.3.260.0130.00316.46
7.3.250.0120.00516.59
7.3.240.0120.00516.48
7.3.230.0070.01016.44
7.3.210.0100.00616.68
7.3.200.0130.00316.34
7.3.190.0060.00916.45
7.3.180.0110.01116.39
7.3.170.0110.00916.57
7.3.160.0030.01316.59
7.2.330.0070.01016.61
7.2.320.0170.01316.61
7.2.310.0060.00916.50
7.2.300.0090.00616.72
7.2.290.0130.00316.53
7.2.110.0200.00316.61
7.2.60.0120.00016.98
7.1.200.0030.00915.75
7.1.70.0000.01117.25
7.1.60.0200.00334.84
7.1.50.0150.00934.91
7.1.40.0200.01734.50
7.1.30.0160.01634.41
7.1.20.0210.00634.47
7.1.10.0100.00316.54
7.1.00.0030.00916.53
7.0.200.0040.00716.75
7.0.190.0000.01216.70
7.0.180.0090.00916.42
7.0.170.0030.01016.15
7.0.160.0000.01216.34
7.0.150.0000.01216.18
7.0.140.0040.00816.39
7.0.130.0000.01116.69
7.0.120.0060.00616.46
7.0.110.0040.00716.21
7.0.100.0080.00416.25
7.0.90.0030.00816.49
7.0.80.0060.00616.33
7.0.70.0000.01316.25
7.0.60.0000.01615.94
7.0.50.0050.00516.40
7.0.40.0060.00616.36
7.0.30.0060.00616.36
7.0.20.0060.00616.38
7.0.10.0030.00716.45
7.0.00.0080.00316.53
5.6.300.0060.05820.62
5.6.290.0100.05220.67
5.6.280.0030.05820.95
5.6.270.0100.05321.03
5.6.260.0000.06221.03
5.6.250.0070.05620.77
5.6.240.0100.06520.74
5.6.230.0000.06420.81
5.6.220.0040.06220.91
5.6.210.0200.04320.55
5.6.200.0100.05520.69
5.6.190.0030.06020.76
5.6.180.0040.06020.89
5.6.170.0070.06520.75
5.6.160.0070.05820.86
5.6.150.0200.04620.99
5.6.140.0030.06020.75
5.6.130.0100.05120.75
5.6.120.0130.05220.72
5.6.110.0070.05820.93
5.6.100.0070.06620.86
5.6.90.0070.05820.92
5.6.80.0160.04320.15
5.6.70.0040.05620.10
5.6.60.0000.06220.33
5.6.50.0100.05120.26
5.6.40.0170.04320.08
5.6.30.0070.05620.08
5.6.20.0060.05520.09
5.6.10.0030.05720.08
5.6.00.0170.04320.05
5.5.380.0100.04917.64
5.5.370.0100.05217.43
5.5.360.0220.04417.39
5.5.350.0040.05617.48
5.5.340.0030.05617.95
5.5.330.0030.05617.95
5.5.320.0130.04718.09
5.5.310.0030.06017.80
5.5.300.0170.04318.02
5.5.290.0030.05918.11
5.5.280.0100.05318.12
5.5.270.0090.05417.79
5.5.260.0060.05817.99
5.5.250.0100.05117.81
5.5.240.0240.03717.41
5.5.230.0130.05017.40
5.5.220.0100.04817.12
5.5.210.0100.05017.12
5.5.200.0100.04717.39
5.5.190.0030.05617.34
5.5.180.0070.05317.38
5.5.160.0100.04717.38
5.5.150.0100.05717.29
5.5.140.0070.05317.39
5.5.130.0160.04317.31
5.5.120.0100.05117.46
5.5.110.0070.05517.37
5.5.100.0030.06617.25
5.5.90.0030.05317.00
5.5.80.0100.05117.28
5.5.70.0160.06517.37
5.5.60.0070.05117.18
5.5.50.0030.05517.27
5.5.40.0160.04216.93
5.5.30.0130.04516.98
5.5.20.0070.05317.18
5.5.10.0140.06816.93
5.5.00.0060.05417.26
5.4.450.0070.05719.39
5.4.440.0130.04919.46
5.4.430.0100.05019.30
5.4.420.0130.05519.34
5.4.410.0100.05019.25
5.4.400.0070.05319.11
5.4.390.0070.05318.92
5.4.380.0140.04519.05
5.4.370.0100.05619.12
5.4.360.0130.04619.08
5.4.350.0070.05219.15
5.4.340.0070.05318.92
5.4.320.0030.05918.92
5.4.310.0100.04819.18
5.4.300.0130.05118.81
5.4.290.0000.06218.85
5.4.280.0070.05518.83
5.4.270.0070.05218.92
5.4.260.0100.07019.02
5.4.250.0100.04919.07
5.4.240.0100.07218.95
5.4.230.0100.06418.82
5.4.220.0000.06119.00
5.4.210.0060.05118.94
5.4.200.0140.04518.94
5.4.190.0160.04218.84
5.4.180.0200.05019.01
5.4.170.0070.05119.13
5.4.160.0140.04318.91
5.4.150.0070.06619.03
5.4.140.0120.04716.54
5.4.130.0130.06116.59
5.4.120.0100.06816.71
5.4.110.0070.05016.54
5.4.100.0070.04816.67
5.4.90.0100.04416.43
5.4.80.0160.03816.43
5.4.70.0030.05216.41
5.4.60.0130.04216.62
5.4.50.0070.05716.66
5.4.40.0190.03616.67
5.4.30.0100.04816.68
5.4.20.0200.03616.59
5.4.10.0100.05016.38
5.4.00.0100.04515.82
5.3.290.0060.05514.66
5.3.280.0070.05214.58
5.3.270.0160.06014.60
5.3.260.0100.04914.42
5.3.250.0070.07114.42
5.3.240.0070.05414.59
5.3.230.0140.06314.80
5.3.220.0100.04414.77
5.3.210.0030.05514.71
5.3.200.0100.04514.55
5.3.190.0070.05014.38
5.3.180.0030.05214.72
5.3.170.0070.04914.68
5.3.160.0070.04814.63
5.3.150.0100.04914.49
5.3.140.0100.05914.70
5.3.130.0130.04914.61
5.3.120.0030.06714.75
5.3.110.0100.04914.63
5.3.100.0030.05414.19
5.3.90.0030.05214.00
5.3.80.0100.04514.00
5.3.70.0170.03814.06
5.3.60.0100.04914.07
5.3.50.0100.04414.11
5.3.40.0130.04214.14
5.3.30.0140.04114.07
5.3.20.0100.04913.77
5.3.10.0070.04713.64
5.3.00.0000.05413.63
5.2.170.0000.04511.35
5.2.160.0030.04011.07
5.2.150.0000.04711.07
5.2.140.0090.03811.36
5.2.130.0070.03711.08
5.2.120.0030.04011.29
5.2.110.0000.04411.08
5.2.100.0090.03411.02
5.2.90.0030.04011.02
5.2.80.0030.04111.19
5.2.70.0060.03811.21
5.2.60.0090.03811.29
5.2.50.0070.04711.03
5.2.40.0000.04311.23
5.2.30.0070.03711.18
5.2.20.0130.02911.19
5.2.10.0030.03911.01
5.2.00.0100.03311.02
5.1.60.0000.03810.21
5.1.50.0030.0349.93
5.1.40.0100.0269.92
5.1.30.0000.03810.59
5.1.20.0000.03810.46
5.1.10.0060.03510.32
5.1.00.0030.03510.26
5.0.50.0030.0288.42
5.0.40.0040.0268.61
5.0.30.0090.0358.38
5.0.20.0030.0268.07
5.0.10.0070.0238.46
5.0.00.0070.0368.36
4.4.90.0000.0246.76
4.4.80.0000.0276.76
4.4.70.0070.0166.76
4.4.60.0070.0166.76
4.4.50.0000.0236.76
4.4.40.0030.0326.76
4.4.30.0030.0206.76
4.4.20.0000.0246.76
4.4.10.0060.0186.76
4.4.00.0030.0326.76
4.3.110.0030.0206.76
4.3.100.0060.0166.76
4.3.90.0030.0196.76
4.3.80.0000.0356.76
4.3.70.0030.0196.76
4.3.60.0000.0236.76
4.3.50.0100.0146.76
4.3.40.0090.0346.76
4.3.30.0060.0236.76
4.3.20.0000.0246.76
4.3.10.0030.0236.76
4.3.00.0000.0236.76

preferences:
67.81 ms | 401 KiB | 5 Q