3v4l.org

run code in 300+ PHP versions simultaneously
<?php $people = [ [ "sponsor" => "Zack", "referal" => "Joey", "status" => 1, ], [ "sponsor" => "Joey", "referal" => "Tracy", "status" => 0, ], [ "sponsor" => "Tracy", "referal" => "Helen", "status" => 0, ], [ "sponsor" => "Helen", "referal" => "Richard", "status" => 0, ], [ "sponsor" => "Felipe", "referal" => "Juan", "status" => 0, ], [ "sponsor" => "Richard", "referal" => "Mike", "status" => 0, ], ]; static $i = 0; function getParentSponsor($referal, $people) { foreach ($people as $pair) { if ($pair["referal"] === $referal) { if ($pair["status"] === 1) { return $pair["sponsor"]; } else { return getParentSponsor($pair["sponsor"], $people); } return $pair["sponsor"]; } } $i++; } echo getParentSponsor("Mike", array_reverse($people));

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.0180.00418.30
8.3.60.0090.00616.88
8.3.50.0130.00718.32
8.3.40.0150.00319.02
8.3.30.0040.01118.66
8.3.20.0000.00820.35
8.3.10.0050.00322.10
8.3.00.0000.00823.66
8.2.190.0100.01016.63
8.2.180.0130.00616.50
8.2.170.0110.01122.96
8.2.160.0080.00620.38
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0000.00726.16
8.2.120.0040.01120.83
8.2.110.0060.01119.04
8.2.100.0090.00318.09
8.2.90.0000.00819.21
8.2.80.0000.00817.97
8.2.70.0000.00817.63
8.2.60.0060.00617.92
8.2.50.0000.00818.16
8.2.40.0000.00720.30
8.2.30.0040.00420.96
8.2.20.0080.00018.00
8.2.10.0000.00818.12
8.2.00.0080.00018.17
8.1.280.0130.00625.92
8.1.270.0060.01222.19
8.1.260.0030.00626.35
8.1.250.0040.00428.09
8.1.240.0070.00322.20
8.1.230.0040.00720.32
8.1.220.0060.00317.79
8.1.210.0050.00318.77
8.1.200.0090.00017.25
8.1.190.0000.00917.35
8.1.180.0000.00818.10
8.1.170.0060.00318.54
8.1.160.0050.00318.81
8.1.150.0040.00420.02
8.1.140.0000.00819.58
8.1.130.0020.00718.25
8.1.120.0060.00617.44
8.1.110.0060.00617.37
8.1.100.0080.00417.51
8.1.90.0070.00517.48
8.1.80.0100.00317.44
8.1.70.0040.00817.49
8.1.60.0080.00417.53
8.1.50.0070.00617.52
8.1.40.0030.00717.54
8.1.30.0070.00517.55
8.1.20.0060.00517.66
8.1.10.0080.00517.60
8.1.00.0070.00617.46
8.0.300.0050.00219.08
8.0.290.0000.00916.63
8.0.280.0000.00818.42
8.0.270.0040.00416.82
8.0.260.0080.00217.54
8.0.250.0070.00316.81
8.0.240.0040.00716.87
8.0.230.0100.00016.87
8.0.220.0060.00516.79
8.0.210.0070.00416.82
8.0.200.0040.00516.82
8.0.190.0080.00316.83
8.0.180.0080.00416.91
8.0.170.0100.00116.84
8.0.160.0060.00516.93
8.0.150.0080.00416.82
8.0.140.0080.00416.79
8.0.130.0040.00715.04
8.0.120.0060.00516.86
8.0.110.0080.00416.79
8.0.100.0010.00816.81
8.0.90.0050.00416.77
8.0.80.0050.00916.81
8.0.70.0030.00616.81
8.0.60.0020.00716.75
8.0.50.0070.00316.83
8.0.30.0090.00617.03
8.0.20.0100.00917.26
8.0.10.0070.00316.93
8.0.00.0090.00516.94
7.4.330.0090.00215.48
7.4.320.0100.00216.55
7.4.300.0090.00516.53
7.4.290.0080.00416.40
7.4.280.0100.00216.55
7.4.270.0070.00416.38
7.4.260.0100.00216.46
7.4.250.0070.00416.51
7.4.240.0040.00816.46
7.4.230.0050.00516.51
7.4.220.0070.00816.60
7.4.210.0050.00916.63
7.4.200.0090.00116.46
7.4.190.0070.00416.45
7.4.180.0070.00416.57
7.4.160.0070.00716.47
7.4.150.0040.00916.82
7.4.140.0090.00717.40
7.4.130.0100.00316.48
7.4.120.0090.00616.50
7.4.110.0060.00616.43
7.4.100.0060.00916.44
7.4.90.0030.00916.40
7.4.80.0080.00517.41
7.4.70.0050.00916.52
7.4.60.0050.00816.38
7.4.50.0090.00416.34
7.4.40.0090.00316.43
7.4.30.0040.00916.47
7.4.20.0040.00616.49
7.4.10.0060.00416.45
7.4.00.0030.01115.94
7.3.330.0100.00014.84
7.3.320.0050.00414.74
7.3.310.0070.00416.32
7.3.300.0060.00416.28
7.3.290.0060.00716.36
7.3.280.0090.00716.37
7.3.270.0060.00716.61
7.3.260.0110.00516.44
7.3.250.0080.00816.42
7.3.240.0080.00716.39
7.3.230.0060.00716.32
7.3.220.0090.00216.29
7.3.210.0090.00316.31
7.3.200.0060.00916.30
7.3.190.0090.00416.25
7.3.180.0060.00916.29
7.3.170.0070.00516.30
7.3.160.0060.00916.37
7.3.150.0090.00216.20
7.3.140.0080.00416.26
7.3.130.0100.00216.22
7.3.120.0080.00715.35
7.3.110.0070.00715.19
7.3.100.0040.00915.45
7.3.90.0060.00815.45
7.3.80.0070.00615.53
7.3.70.0070.00715.37
7.3.60.0070.00715.39
7.3.50.0080.00515.37
7.3.40.0040.00815.51
7.3.30.0070.00415.47
7.3.20.0090.00417.34
7.3.10.0060.00717.27
7.3.00.0080.00617.25
7.2.340.0070.00416.30
7.2.330.0060.00816.45
7.2.320.0100.00516.44
7.2.310.0060.00716.46
7.2.300.0060.00916.41
7.2.290.0070.00616.49
7.2.280.0070.00516.40
7.2.270.0060.00616.31
7.2.260.0100.00216.32
7.2.250.0090.00515.92
7.2.240.0050.00915.58
7.2.230.0080.00615.48
7.2.220.0060.00615.50
7.2.210.0050.00715.65
7.2.200.0020.01015.70
7.2.190.0070.00615.72
7.2.180.0040.00915.75
7.2.170.0090.00515.66
7.2.160.0090.00516.03
7.2.150.0090.00417.62
7.2.140.0080.00617.46
7.2.130.0060.01017.52
7.2.120.0090.00617.50
7.2.110.0080.00717.42
7.2.100.0050.00817.55
7.2.90.0050.00917.57
7.2.80.0110.00517.60
7.2.70.0080.00517.63
7.2.60.0040.00917.43
7.2.50.0060.01017.53
7.2.40.0080.00617.63
7.2.30.0070.01017.73
7.2.20.0090.00617.61
7.2.10.0070.00717.72
7.2.00.0070.00817.57
7.1.330.0060.00816.46
7.1.320.0070.00616.44
7.1.310.0080.00516.38
7.1.300.0090.00416.41
7.1.290.0080.00716.37
7.1.280.0070.00616.42
7.1.270.0060.00516.40
7.1.260.0070.00616.42
7.1.250.0080.00716.43
7.1.240.0050.00817.21
7.1.230.0070.00617.36
7.1.220.0110.00217.33
7.1.210.0100.00217.34
7.1.200.0080.00516.58
7.1.190.0080.00417.24
7.1.180.0100.00417.16
7.1.170.0080.00417.23
7.1.160.0060.00517.27
7.1.150.0370.00517.09
7.1.140.0120.00517.08
7.1.130.0100.00717.13
7.1.120.0060.01117.10
7.1.110.0110.00516.91
7.1.100.0080.00717.18
7.1.90.0090.00817.08
7.1.80.0090.00817.31
7.1.70.0060.01016.75
7.1.60.0190.00825.78
7.1.50.0180.00525.56
7.1.40.0170.00725.47
7.1.30.0190.00625.52
7.1.20.0170.01025.53
7.1.10.0090.00616.48
7.1.00.0070.00716.50
7.0.330.0080.00316.93
7.0.320.0090.00116.91
7.0.310.0100.00217.02
7.0.300.0070.00416.95
7.0.290.0070.00416.89
7.0.280.0100.00217.05
7.0.270.0080.00716.82
7.0.260.0090.00616.81
7.0.250.0100.00516.61
7.0.240.0080.00617.00
7.0.230.0060.00916.99
7.0.220.0090.00717.00
7.0.210.0050.01016.35
7.0.200.0080.00616.45
7.0.190.0110.00416.39
7.0.180.0080.00716.19
7.0.170.0100.00416.15
7.0.160.0090.00816.07
7.0.150.0080.00616.15
7.0.140.0250.00716.16
7.0.130.0070.00916.30
7.0.120.0070.00616.29
7.0.110.0060.00916.25
7.0.100.0080.00716.18
7.0.90.0080.00716.19
7.0.80.0070.00716.06
7.0.70.0060.00816.14
7.0.60.0060.00716.11
7.0.50.0080.00816.26
7.0.40.0080.00616.27
7.0.30.0070.00816.24
7.0.20.0080.00716.22
7.0.10.0070.00716.18
7.0.00.0050.00916.25
5.6.400.0030.00715.74
5.6.390.0070.00415.74
5.6.380.0080.00315.80
5.6.370.0080.00315.88
5.6.360.0050.00615.81
5.6.350.0080.00315.83
5.6.340.0030.00815.74
5.6.330.0080.00315.77
5.6.320.0050.00515.70
5.6.310.0070.00415.86
5.6.300.0080.00215.74
5.6.290.0040.00615.75
5.6.280.0080.00215.83
5.6.270.0080.00215.82
5.6.260.0060.00415.79
5.6.250.0060.00415.79
5.6.240.0020.00816.09
5.6.230.0080.00316.08
5.6.220.0080.00316.00
5.6.210.0050.00516.03
5.6.200.0080.00116.01
5.6.190.0040.00616.26
5.6.180.0050.00516.04
5.6.170.0110.00016.26
5.6.160.0100.00016.13
5.6.150.0060.00416.11
5.6.140.0090.00216.08
5.6.130.0060.00516.09
5.6.120.0090.00315.92
5.6.110.0090.00215.87
5.6.100.0110.00015.89
5.6.90.0060.00415.83
5.6.80.0070.00315.83
5.6.70.0050.00516.04
5.6.60.0080.00216.01
5.6.50.0090.00015.85
5.6.40.0020.00715.90
5.6.30.0060.00415.98
5.6.20.0070.00315.94
5.6.10.0060.00315.90
5.6.00.0050.00515.83

preferences:
65.8 ms | 401 KiB | 5 Q