3v4l.org

run code in 300+ PHP versions simultaneously
<?php $i = 0; function is_cyclic(array &$array) { global $i; // Exit when too deep. if (++$i > 10) exit; echo "Call $i:\n"; var_dump($GLOBALS['bomb']); echo "\n"; $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)) { //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(); is_cyclic($bomb);

Abusive script

This script was stopped while abusing our resources

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.110.0030.00620.94
8.3.100.0150.00316.91
8.3.90.0080.00026.77
8.3.80.0030.00619.36
8.3.70.0150.00916.63
8.3.60.0130.01018.43
8.3.50.0140.00923.59
8.3.40.0130.01019.04
8.3.30.0030.01318.80
8.3.20.0030.01724.18
8.3.10.0130.00624.66
8.3.00.0060.00326.16
8.2.230.0030.00622.58
8.2.220.0090.00024.06
8.2.210.0030.00726.77
8.2.200.0150.00018.88
8.2.190.0150.00016.91
8.2.180.0100.00625.92
8.2.170.0200.00718.91
8.2.160.0090.00622.96
8.2.150.0070.00325.66
8.2.140.0090.00024.66
8.2.130.0090.00026.16
8.2.120.0090.00021.07
8.2.110.0030.00619.22
8.2.100.0090.00417.91
8.2.90.0080.00018.16
8.2.80.0000.00820.58
8.2.70.0030.01018.04
8.2.60.0060.00317.77
8.2.50.0040.00418.10
8.2.40.0060.00619.47
8.2.30.0030.00519.37
8.2.20.0040.00418.12
8.2.10.0000.00819.19
8.2.00.0050.00319.27
8.1.290.0060.00330.84
8.1.280.0100.00725.92
8.1.270.0050.00324.66
8.1.260.0030.01326.35
8.1.250.0040.00428.09
8.1.240.0070.00322.19
8.1.230.0060.00620.76
8.1.220.0000.00817.74
8.1.210.0000.00818.85
8.1.200.0040.00417.48
8.1.190.0000.00817.35
8.1.180.0000.01018.10
8.1.170.0050.00318.59
8.1.160.0030.00519.07
8.1.150.0000.00818.56
8.1.140.0060.00318.93
8.1.130.0040.00417.49
8.1.120.0000.00817.38
8.1.110.0050.00317.47
8.1.100.0040.00417.49
8.1.90.0030.00517.36
8.1.80.0030.00617.47
8.1.70.0000.00717.48
8.1.60.0060.00317.66
8.1.50.0000.00817.43
8.1.40.0080.00417.41
8.1.30.0040.00417.53
8.1.20.0000.00817.66
8.1.10.0030.00617.55
8.1.00.0040.00417.49
8.0.300.0040.00420.23
8.0.290.0000.00816.75
8.0.280.0040.00418.33
8.0.270.0040.00418.09
8.0.260.0000.00816.86
8.0.250.0030.00616.96
8.0.240.0030.00617.06
8.0.230.0000.00816.98
8.0.220.0000.00716.80
8.0.210.0070.00016.96
8.0.200.0000.00817.08
8.0.190.0040.00417.00
8.0.180.0000.00817.04
8.0.170.0000.00916.89
8.0.160.0000.00817.01
8.0.150.0080.00016.76
8.0.140.0060.00616.87
8.0.130.0060.00013.41
8.0.120.0040.00416.82
8.0.110.0080.00016.99
8.0.100.0050.00316.76
8.0.90.0040.00417.00
8.0.80.0070.01016.91
8.0.70.0050.00316.89
8.0.60.0080.00016.95
8.0.50.0050.00316.75
8.0.30.0090.01217.11
8.0.20.0200.00616.97
8.0.10.0050.00317.12
8.0.00.0110.01117.86
7.4.330.0000.00515.55
7.4.320.0000.00716.49
7.4.300.0060.00316.41
7.4.290.0040.00416.56
7.4.280.0080.00016.59
7.4.270.0000.00916.63
7.4.260.0030.00313.22
7.4.250.0000.00816.52
7.4.240.0040.00416.53
7.4.230.0040.00416.30
7.4.220.0040.00316.61
7.4.210.0110.00616.55
7.4.200.0030.00516.61
7.4.140.0220.00617.86
7.4.130.0250.00017.86
7.4.120.0100.01017.86
7.4.110.0170.00717.86
7.4.100.0060.01517.86
7.4.90.0140.01217.86
7.4.80.0130.01017.86
7.4.70.0080.01517.86
7.4.60.0190.01317.86
7.4.50.0180.01317.86
7.4.40.0060.01517.86
7.4.30.0180.00017.86
7.4.20.0180.00317.86
7.4.10.0140.00717.86
7.4.00.0070.01417.86
7.3.330.0030.00516.46
7.3.320.0000.00613.42
7.3.310.0000.00816.47
7.3.300.0070.00016.49
7.3.290.0060.01216.43
7.3.260.0150.01317.86
7.3.250.0140.00917.86
7.3.240.0150.01117.86
7.3.230.0110.01117.86
7.3.220.0130.00917.86
7.3.210.0190.00317.86
7.3.200.0100.01317.86
7.3.190.0120.00917.86
7.3.180.0110.01117.86
7.3.170.0100.01017.86
7.3.160.0120.00917.86
7.3.150.0160.00717.86
7.3.140.0000.02117.86
7.3.130.0180.00517.86
7.3.120.0180.01017.86
7.3.110.0200.00317.86
7.3.100.0140.01117.86
7.3.90.0060.01517.86
7.3.80.0090.01317.86
7.3.70.0160.00417.86
7.3.60.0210.00017.86
7.3.50.0180.00417.86
7.3.40.0090.01217.86
7.3.30.0050.01517.86
7.3.20.0190.00617.86
7.3.10.0220.00017.86
7.3.00.0030.01617.86

preferences:
37.09 ms | 403 KiB | 5 Q