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 = [[null]]; $array[0][0] = &$array; return $array; } $bomb = craft_bomb(); is_cyclic($bomb);

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.0030.01316.58
8.3.60.0130.00718.55
8.3.50.0150.00616.29
8.3.40.0160.00318.70
8.3.30.0040.01218.74
8.3.20.0080.00024.18
8.3.10.0030.00624.66
8.3.00.0060.00326.16
8.2.190.0130.01016.85
8.2.180.0110.00825.92
8.2.170.0160.00019.08
8.2.160.0090.00922.96
8.2.150.0060.00325.66
8.2.140.0030.00624.66
8.2.130.0050.00326.16
8.2.120.0030.00519.79
8.2.110.0060.00320.57
8.2.100.0070.00617.91
8.2.90.0060.00317.88
8.2.80.0040.00418.92
8.2.70.0030.00517.63
8.2.60.0000.00817.75
8.2.50.0000.00918.05
8.2.40.0040.00418.28
8.2.30.0080.00018.13
8.2.20.0000.00818.04
8.2.10.0030.00619.38
8.2.00.0060.00319.26
8.1.280.0100.01325.92
8.1.270.0070.00423.99
8.1.260.0030.00626.35
8.1.250.0000.01028.09
8.1.240.0040.01520.78
8.1.230.0120.00022.12
8.1.220.0060.00317.74
8.1.210.0080.00018.77
8.1.200.0000.00817.47
8.1.190.0030.00617.35
8.1.180.0040.00418.10
8.1.170.0030.00518.41
8.1.160.0000.00718.89
8.1.150.0040.00418.95
8.1.140.0040.00418.86
8.1.130.0080.00020.14
8.1.120.0040.00417.45
8.1.110.0080.00017.51
8.1.100.0000.00717.35
8.1.90.0000.00817.51
8.1.80.0030.00917.52
8.1.70.0000.00717.35
8.1.60.0080.00017.62
8.1.50.0060.00317.39
8.1.40.0040.00417.41
8.1.30.0030.00617.55
8.1.20.0000.00817.65
8.1.10.0030.00717.59
8.1.00.0030.00617.45
8.0.300.0050.00318.77
8.0.290.0000.00816.75
8.0.280.0040.00418.45
8.0.270.0040.00418.06
8.0.260.0040.00418.54
8.0.250.0030.00517.01
8.0.240.0040.00417.02
8.0.230.0000.00716.93
8.0.220.0030.00316.82
8.0.210.0000.00816.95
8.0.200.0040.00416.96
8.0.190.0090.00016.91
8.0.180.0000.00816.87
8.0.170.0090.00016.99
8.0.160.0040.00417.02
8.0.150.0040.00416.93
8.0.140.0030.00616.90
8.0.130.0070.00013.39
8.0.120.0000.00816.87
8.0.110.0030.00516.85
8.0.100.0000.00716.85
8.0.90.0040.00416.91
8.0.80.0030.01316.87
8.0.70.0040.00416.91
8.0.60.0050.00317.02
8.0.50.0020.00516.83
8.0.30.0090.00917.04
8.0.20.0090.01217.08
8.0.10.0040.00417.07
8.0.00.0140.00716.82
7.4.330.0050.00015.55
7.4.320.0000.00616.56
7.4.300.0000.00716.41
7.4.290.0000.00916.45
7.4.280.0050.00316.50
7.4.270.0030.00516.63
7.4.260.0050.00013.34
7.4.250.0000.00716.58
7.4.240.0040.00416.41
7.4.230.0070.00016.50
7.4.220.0000.00816.53
7.4.210.0050.01316.54
7.4.200.0040.00416.63
7.4.130.0160.00316.44
7.4.120.0060.01316.57
7.4.110.0200.00416.62
7.4.100.0100.01316.36
7.4.90.0060.01416.45
7.4.80.0140.00716.58
7.4.70.0120.00816.34
7.4.60.0100.01016.51
7.4.50.0030.01916.49
7.4.40.0130.00716.57
7.4.30.0150.00616.70
7.4.20.0130.00716.65
7.4.10.0130.00616.39
7.4.00.0110.01116.75
7.3.330.0050.00316.32
7.3.320.0030.00313.26
7.3.310.0040.00416.45
7.3.300.0030.00316.31
7.3.290.0110.00416.46
7.3.260.0170.01016.40
7.3.250.0100.01016.45
7.3.240.0180.00416.38
7.3.230.0140.00716.30
7.3.220.0140.01116.43
7.3.210.0090.01216.53
7.3.200.0170.00316.41
7.3.190.0100.01016.50
7.3.180.0030.01616.25
7.3.170.0040.01616.46
7.3.160.0110.00816.45
7.3.150.0110.01116.50
7.3.140.0130.00616.60
7.3.130.0190.00016.45
7.3.120.0170.00316.63
7.3.110.0120.00616.38
7.3.100.0130.00616.52
7.3.90.0060.01316.52
7.3.80.0170.00316.53
7.3.70.0170.00416.31
7.3.60.0140.00916.44
7.3.50.0120.00916.50
7.3.40.0090.01116.47
7.3.30.0180.00016.34
7.3.20.0130.00716.40
7.3.10.0120.00916.45
7.3.00.0000.02216.44

preferences:
49.36 ms | 401 KiB | 5 Q