3v4l.org

run code in 500+ PHP versions simultaneously
<?php function is_cyclic(array &$array, int $maxDepth = -1) { if ($maxDepth === 0) { throw new Exception('Maximum nesting level exceeded.'); } $lastKey = array_key_last($array); if ($lastKey === null) { // Array is empty return false; } static $marker; if ($marker === null) { $marker = new stdClass(); } if ($array[$lastKey] === $marker) { return true; } $array[] = $marker; foreach ($array as &$item) { if (is_array($item) && is_cyclic($item, $maxDepth - 1)) { array_pop($array); return true; } } array_pop($array); return false; } function craft_bomb() { $array = [1, [2, 3]]; $array[1][1] = &$array; return $array; } $bomb = craft_bomb(); var_export(is_cyclic($bomb, 10));

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.5.90.0110.00817.92
8.5.80.0060.00717.97
8.5.70.0130.00517.72
8.5.60.0070.00718.95
8.5.50.0090.00818.74
8.5.40.0070.00218.66
8.5.30.0090.00518.94
8.5.20.0100.00817.75
8.5.10.0200.00616.82
8.5.00.0090.00819.42
8.4.240.0110.01120.55
8.4.230.0120.00920.64
8.4.220.0130.00520.55
8.4.210.0100.00520.58
8.4.200.0160.01121.58
8.4.190.0130.00821.70
8.4.180.0140.01020.73
8.4.170.0140.00922.81
8.4.160.0120.01022.43
8.4.150.0080.00518.53
8.4.140.0150.00718.80
8.4.130.0150.00718.80
8.4.120.0150.00721.94
8.4.110.0130.01020.84
8.4.100.0120.00619.17
8.4.90.0120.01019.35
8.4.80.0130.00819.23
8.4.70.0140.00919.09
8.4.60.0160.00818.39
8.4.50.0100.00720.30
8.4.40.0110.00917.84
8.4.30.0120.01019.23
8.4.20.0100.01318.85
8.4.10.0110.00619.90
8.3.330.0140.00919.46
8.3.320.0130.00920.43
8.3.310.0100.00619.53
8.3.300.0140.00820.62
8.3.290.0160.00620.53
8.3.280.0130.01019.38
8.3.270.0120.00817.64
8.3.260.0100.00717.59
8.3.250.0080.00517.78
8.3.240.0100.00518.01
8.3.230.0080.00517.77
8.3.220.0070.00618.84
8.3.210.0100.00517.63
8.3.200.0080.00717.65
8.3.190.0130.00818.02
8.3.180.0140.00718.55
8.3.170.0170.00417.91
8.3.160.0140.00717.80
8.3.150.0130.00718.05
8.3.140.0060.01118.65
8.3.130.0110.00418.44
8.3.120.0070.00918.73
8.3.110.0150.00719.78
8.3.100.0110.00521.40
8.3.90.0150.00222.64
8.3.80.0110.00618.94
8.3.70.0120.00718.55
8.3.60.0170.00417.61
8.3.50.0120.00622.57
8.3.40.0120.00719.46
8.3.30.0130.00719.23
8.3.20.0090.00821.93
8.3.10.0110.00422.21
8.3.00.0120.00523.02
8.2.330.0230.00619.82
8.2.320.0100.00818.13
8.2.310.0140.00818.17
8.2.300.0240.00820.08
8.2.290.0210.00718.64
8.2.280.0190.00617.81
8.2.270.0140.00816.90
8.2.260.0190.00917.96
8.2.250.0170.00716.71
8.2.240.0190.00717.07
8.2.230.0170.00619.68
8.2.220.0130.00927.13
8.2.210.0170.00521.68
8.2.200.0170.00817.75
8.2.190.0230.00316.66
8.2.180.0180.00721.27
8.2.170.0220.00618.53
8.2.160.0230.00320.55
8.2.150.0180.00521.81
8.2.140.0160.00921.25
8.2.130.0170.00622.08
8.2.120.0170.00522.17
8.2.110.0150.00819.52
8.2.100.0190.00517.88
8.2.90.0160.00719.28
8.2.80.0150.00817.91
8.2.70.0150.00718.00
8.2.60.0070.00918.01
8.2.50.0190.00218.05
8.2.40.0150.00518.07
8.2.30.0210.00218.06
8.2.20.0140.00818.12
8.2.10.0140.00618.65
8.2.00.0150.00718.59
8.1.340.0220.01118.60
8.1.330.0180.00919.22
8.1.320.0200.00616.20
8.1.310.0200.00717.39
8.1.300.0180.00617.82
8.1.290.0170.00623.44
8.1.280.0190.00921.07
8.1.270.0150.00721.22
8.1.260.0180.00422.91
8.1.250.0130.00522.93
8.1.240.0130.00319.92
8.1.230.0140.00519.30
8.1.220.0120.00417.76
8.1.210.0100.00718.32
8.1.200.0130.00517.57
8.1.190.0110.00617.48
8.1.180.0080.00917.85
8.1.170.0090.01118.11
8.1.160.0080.00918.29
8.1.150.0090.00618.24
8.1.140.0060.00818.20
8.1.130.0070.00618.88
8.1.120.0090.00717.63
8.1.110.0090.00717.59
8.1.100.0120.00417.65
8.1.90.0120.00517.50
8.1.80.0130.00417.56
8.1.70.0120.00517.51
8.1.60.0100.00817.63
8.1.50.0100.00817.57
8.1.40.0090.00817.65
8.1.30.0120.00417.74
8.1.20.0080.01017.75
8.1.10.0060.00817.71
8.1.00.0080.00217.63
8.0.300.0090.00518.57
8.0.290.0080.00816.96
8.0.280.0120.00417.73
8.0.270.0110.00517.63
8.0.260.0090.00617.80
8.0.250.0090.00517.10
8.0.240.0110.00318.02
8.0.230.0100.00517.97
8.0.220.0060.00717.89
8.0.210.0160.00416.89
8.0.200.0180.00716.98
8.0.190.0220.00217.00
8.0.180.0170.00517.13
8.0.170.0140.00417.01
8.0.160.0150.00517.02
8.0.150.0160.00516.90
8.0.140.0110.00517.04
8.0.130.0140.00615.18
8.0.120.0070.00816.92
8.0.110.0090.00617.10
8.0.100.0080.00717.88
8.0.90.0080.00617.87
8.0.80.0080.01017.57
8.0.70.0070.00617.95
8.0.60.0080.00517.78
8.0.50.0060.00717.86
8.0.30.0110.00818.05
8.0.20.0120.00718.01
8.0.10.0270.00517.98
8.0.00.0210.01118.10
7.4.330.0080.00317.10
7.4.320.0060.00617.48
7.4.300.0070.00617.49
7.4.290.0080.00517.57
7.4.280.0090.00417.50
7.4.270.0090.00617.52
7.4.260.0070.00515.88
7.4.250.0100.00317.52
7.4.240.0060.00617.52
7.4.230.0080.00717.64
7.4.220.0050.00817.40
7.4.210.0080.00817.04
7.4.200.0080.00517.63
7.4.190.0100.00818.49
7.4.180.0140.00618.53
7.4.160.0130.00918.27
7.4.150.0130.00818.49
7.4.140.0170.01417.59
7.4.130.0220.00717.42
7.4.120.0240.00817.33
7.4.110.0210.00817.44
7.4.100.0210.00717.39
7.4.90.0240.00517.46
7.4.80.0220.00717.48
7.4.70.0180.01217.39
7.4.60.0190.01017.46
7.4.50.0220.00717.45
7.4.40.0190.01117.38
7.4.30.0160.01217.54
7.4.20.0200.00917.38
7.4.10.0230.00417.45
7.4.00.0200.00817.57
7.3.330.0090.00417.45
7.3.320.0050.00615.99
7.3.310.0070.00517.48
7.3.300.0040.00617.49
7.3.290.0110.00516.93
7.3.280.0110.00718.25
7.3.270.0080.00718.48
7.3.260.0080.00617.40
7.3.250.0180.00517.47
7.3.240.0180.00517.40
7.3.230.0170.00317.52
7.3.220.0160.00817.36
7.3.210.0170.00817.38
7.3.200.0160.00717.42
7.3.190.0190.00617.41
7.3.180.0210.00717.45
7.3.170.0160.00817.51
7.3.160.0210.00917.45
7.3.150.0210.00317.42
7.3.140.0160.01017.50
7.3.130.0190.01117.38
7.3.120.0180.01017.43
7.3.110.0160.01217.36
7.3.100.0180.01117.27
7.3.90.0190.00917.52
7.3.80.0210.00917.48
7.3.70.0190.01117.41
7.3.60.0180.01217.56
7.3.50.0220.00917.60
7.3.40.0200.01017.45
7.3.30.0180.01117.46
7.3.20.0270.00317.47
7.3.10.0220.00917.47
7.3.00.0210.00817.39

preferences:
53.8 ms | 1584 KiB | 5 Q