3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Node { public $child; } function hasCycle($node) { $hare = $node; while ($node->child) { $node = $node->child; $hard = $hard->child->child; if ($node == $hare) { return true; } } return false; } function getLinkedList($length, $cycle = false) { $root = $node = new Node; $cycle_node = null; while ($length--) { $new_node = new Node; $node->child = $new_node; $node = $new_node; if ($cycle && $length == floor($length / 2)) { $cycle_node = $node; } } if ($cycle) { $node->child = $cycle_node; } return $root; } $cycled_list = getLinkedList(100, true); $list = getLinkedList(100, false); var_dump(has_cycle($cycled_list), has_cycle($list));

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.0120.00316.62
8.3.50.0140.00821.26
8.3.40.0090.00618.97
8.3.30.0110.00318.80
8.3.20.0040.00420.47
8.3.10.0080.00023.61
8.3.00.0040.00418.16
8.2.180.0120.00318.29
8.2.170.0070.01422.96
8.2.160.0100.00320.56
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0050.00226.16
8.2.120.0000.00917.75
8.2.110.0050.00520.96
8.2.100.0000.01217.97
8.2.90.0000.00818.05
8.2.80.0000.00818.90
8.2.70.0030.00617.63
8.2.60.0040.00417.63
8.2.50.0000.00817.93
8.2.40.0040.00417.92
8.2.30.0030.00720.56
8.2.20.0020.00517.77
8.2.10.0070.00018.15
8.2.00.0000.00918.25
8.1.280.0080.00825.92
8.1.270.0040.00423.82
8.1.260.0030.00726.35
8.1.250.0070.00028.09
8.1.240.0080.00323.98
8.1.230.0090.00322.63
8.1.220.0050.00318.67
8.1.210.0080.00018.77
8.1.200.0040.00417.46
8.1.190.0000.01017.35
8.1.180.0080.00018.10
8.1.170.0040.00417.62
8.1.160.0050.00321.96
8.1.150.0040.00418.96
8.1.140.0050.00319.23
8.1.130.0050.00217.73
8.1.120.0030.00617.56
8.1.110.0000.00817.46
8.1.100.0040.00417.49
8.1.90.0040.00417.52
8.1.80.0040.00317.56
8.1.70.0040.00417.43
8.1.60.0080.00017.71
8.1.50.0040.00417.47
8.1.40.0040.00417.60
8.1.30.0000.00817.68
8.1.20.0080.00017.72
8.1.10.0060.00317.68
8.1.00.0000.00717.62
8.0.300.0030.00518.77
8.0.290.0030.00516.88
8.0.280.0030.00318.50
8.0.270.0030.00317.37
8.0.260.0000.00617.37
8.0.250.0070.00016.94
8.0.240.0000.00817.09
8.0.230.0050.00217.09
8.0.220.0050.00316.99
8.0.210.0040.00317.00
8.0.200.0000.00616.97
8.0.190.0000.00817.11
8.0.180.0080.00416.94
8.0.170.0040.00416.95
8.0.160.0000.00917.03
8.0.150.0000.00816.86
8.0.140.0070.00016.95
8.0.130.0000.00613.41
8.0.120.0000.00717.03
8.0.110.0060.00316.92
8.0.100.0040.00416.88
8.0.90.0030.00517.05
8.0.80.0060.00916.94
8.0.70.0050.00317.09
8.0.60.0040.00417.09
8.0.50.0040.00417.01
8.0.30.0120.00517.21
8.0.20.0050.01417.40
8.0.10.0000.00717.00
8.0.00.0100.00816.88
7.4.330.0000.00515.08
7.4.320.0030.00316.48
7.4.300.0060.00016.62
7.4.290.0050.00316.48
7.4.280.0060.00316.67
7.4.270.0000.00716.62
7.4.260.0040.00416.68
7.4.250.0040.00416.44
7.4.240.0040.00416.61
7.4.230.0000.00716.37
7.4.220.0120.00616.50
7.4.210.0000.01516.50
7.4.200.0030.00316.75
7.4.160.0080.00816.54
7.4.150.0090.00917.40
7.4.140.0080.01617.86
7.4.130.0060.01216.56
7.4.120.0130.00816.63
7.4.110.0120.00616.55
7.4.100.0100.01316.49
7.4.90.0070.01016.68
7.4.80.0190.00619.39
7.4.70.0130.01216.55
7.4.60.0130.00316.64
7.4.50.0050.00516.57
7.4.40.0140.00316.34
7.4.30.0100.01016.48
7.4.00.0120.00015.21
7.3.330.0030.00313.32
7.3.320.0000.00613.42
7.3.310.0030.00316.48
7.3.300.0040.00416.30
7.3.290.0070.00916.46
7.3.280.0110.00916.46
7.3.270.0100.00717.40
7.3.260.0060.01416.71
7.3.250.0120.00616.58
7.3.240.0090.01416.59
7.3.230.0100.00716.70
7.3.210.0090.00916.57
7.3.200.0130.00416.43
7.3.190.0100.00716.66
7.3.180.0060.01016.52
7.3.170.0090.00916.69
7.3.160.0100.00616.54
7.2.330.0090.00916.76
7.2.320.0110.01116.79
7.2.310.0120.00416.77
7.2.300.0070.01416.75
7.2.290.0070.01016.69
7.2.60.0000.01517.05
7.2.00.0030.01019.70
7.1.200.0030.01015.97
7.1.100.0080.00518.13
7.1.70.0040.00417.14
7.1.60.0100.01419.50
7.1.50.0110.01117.04
7.1.00.0070.07322.31
7.0.200.0150.01216.39
7.0.60.0070.06719.95
7.0.50.0070.07017.97
7.0.40.0030.05020.20
7.0.30.0370.07320.20
7.0.20.0230.07020.16
7.0.10.0070.08320.24
7.0.00.0000.04320.09
5.6.280.0070.03321.14
5.6.210.0170.08020.69
5.6.200.0100.08318.20
5.6.190.0130.07320.61
5.6.180.0300.07320.37
5.6.170.0400.04020.43
5.6.160.0030.09020.59
5.6.150.0070.04018.32
5.6.140.0100.07718.24
5.6.130.0100.08718.21
5.6.120.0000.04321.05
5.6.110.0130.08321.07
5.6.100.0070.07721.05
5.6.90.0130.07721.04
5.6.80.0170.07320.59
5.5.350.0070.03020.47
5.5.340.0100.05717.99
5.5.330.0000.07320.33
5.5.320.3870.04720.27
5.5.310.0500.07320.55
5.5.300.0000.04018.11
5.5.290.0130.06718.06
5.5.280.0000.06720.94
5.5.270.0030.08720.80
5.5.260.0030.05320.92
5.5.250.0100.05720.53
5.5.240.0070.07320.41
5.4.450.0600.06319.38
5.4.440.0800.04719.65
5.4.430.0630.08019.20
5.4.420.0600.06019.64
5.4.410.0570.07019.38
5.4.400.0900.05019.30
5.4.390.0670.06719.05
5.4.380.0630.07319.04
5.4.370.0700.07019.19
5.4.360.0770.05719.30
5.4.350.0600.05719.18
5.4.340.0730.07019.18
5.4.320.0700.05319.16
5.4.310.0670.05719.10
5.4.300.0570.05319.02
5.4.290.0530.05319.29
5.4.280.0800.05019.29
5.4.270.0770.04319.32
5.4.260.0470.06019.04
5.4.250.0770.05019.18
5.4.240.0630.06319.30
5.4.230.0870.06319.15
5.4.220.0730.06019.29
5.4.210.0830.05019.28
5.4.200.0630.05719.09
5.4.190.0630.06319.15
5.4.180.0500.05719.33
5.4.170.0570.05719.09
5.4.160.0670.05719.28
5.4.150.0670.06319.32
5.4.140.0870.05016.41
5.4.130.0930.04716.61
5.4.120.0970.03316.52
5.4.110.0730.07016.75
5.4.100.0870.06716.37
5.4.90.0830.06316.52
5.4.80.0800.04716.65
5.4.70.0300.06716.52
5.4.60.0070.03316.50
5.4.50.0030.06316.31
5.4.40.0230.03716.48
5.4.30.0270.07016.57
5.4.20.0070.05716.57

preferences:
56.72 ms | 401 KiB | 5 Q