3v4l.org

run code in 300+ PHP versions simultaneously
<?php function remove_recursion($o){ static $replace; if(!isset($replace)) $replace = create_function('$m','$r="\x00{$m[1]}ecursion_";return \'s:\'.strlen($r.$m[2]).\':"\'.$r.$m[2].\'";\';') ; if(is_array($o) || is_object($o)){ $re = '#(r|R):([0-9]+);#'; $serialize = serialize($o); if(preg_match($re, $serialize)){ $last = $pos = 0; while(false !== ($pos = strpos($serialize, 's:', $pos))){ $chunk = substr($serialize, $last, $pos - $last); if(preg_match($re, $chunk)){ $length = strlen($chunk); $chunk = preg_replace_callback($re, $replace, $chunk); $serialize = substr($serialize, 0, $last).$chunk.substr($serialize, $last + ($pos - $last)); $pos += strlen($chunk) - $length; } $pos += 2; $last = strpos($serialize, ':', $pos); $length = substr($serialize, $pos, $last- $pos); $last += 4 + $length; $pos = $last; } $serialize = substr($serialize, 0, $last).preg_replace_callback($re, $replace, substr($serialize, $last)); $o = unserialize($serialize); } } return $o; } $o = new stdClass; $o->n = $o; $o->r = &$o; echo serialize($o), ' ', serialize( remove_recursion($o) ) ;

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.0150.00018.81
8.3.50.0140.00522.11
8.3.40.0070.00718.98
8.3.30.0070.01419.04
8.3.20.0080.00020.33
8.3.10.0000.00921.99
8.3.00.0030.00622.34
8.2.180.0040.01518.29
8.2.170.0120.00322.96
8.2.160.0070.00720.93
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0080.00019.50
8.2.110.0030.00722.13
8.2.100.0060.00618.03
8.2.90.0040.00419.13
8.2.80.0000.00818.12
8.2.70.0050.00317.63
8.2.60.0040.00417.80
8.2.50.0030.00518.07
8.2.40.0040.00418.22
8.2.30.0040.00417.96
8.2.20.0030.00517.78
8.2.10.0040.00419.39
8.2.00.0040.00417.64
8.1.280.0070.00725.92
8.1.270.0040.00422.20
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0030.00623.86
8.1.230.0080.00319.10
8.1.220.0080.00017.79
8.1.210.0000.00818.77
8.1.200.0060.00617.35
8.1.190.0080.00017.63
8.1.180.0040.00418.73
8.1.170.0030.00618.62
8.1.160.0040.00421.88
8.1.150.0040.00418.71
8.1.140.0040.00417.47
8.1.130.0030.00317.72
8.1.120.0050.00317.55
8.1.110.0080.00017.45
8.1.100.0070.00017.46
8.1.90.0000.00717.45
8.1.80.0020.00517.38
8.1.70.0040.00417.39
8.1.60.0030.00517.60
8.1.50.0030.00617.41
8.1.40.0000.00717.52
8.1.30.0060.00317.59
8.1.20.0000.00817.58
8.1.10.0070.00017.64
8.1.00.0000.00817.55
8.0.300.0060.00318.77
8.0.290.0030.00317.29
8.0.280.0030.00318.52
8.0.270.0070.00017.17
8.0.260.0030.00318.34
8.0.250.0000.00717.04
8.0.240.0040.00417.10
8.0.230.0030.00317.02
8.0.220.0000.00716.95
8.0.210.0030.00316.99
8.0.200.0000.00716.90
8.0.190.0000.00817.03
8.0.180.0000.00916.89
8.0.170.0000.00816.84
8.0.160.0040.00416.83
8.0.150.0070.00016.92
8.0.140.0080.00016.83
8.0.130.0000.00613.45
8.0.120.0000.00817.02
8.0.110.0040.00416.86
8.0.100.0050.00316.80
8.0.90.0040.00416.79
8.0.80.0130.00316.92
8.0.70.0000.00716.97
8.0.60.0040.00416.97
8.0.50.0040.00416.97
8.0.30.0110.01017.23
8.0.20.0100.01017.40
8.0.10.0040.00416.95
8.0.00.0100.00816.67
7.4.330.0020.00215.00
7.4.320.0030.00316.87
7.4.300.0070.00016.83
7.4.290.0080.00016.84
7.4.280.0000.01016.83
7.4.270.0000.00716.86
7.4.260.0090.00016.84
7.4.250.0000.00716.83
7.4.240.0020.00616.76
7.4.230.0070.00016.84
7.4.220.0070.01017.00
7.4.210.0050.01116.89
7.4.200.0000.00916.74
7.4.190.0000.00716.68
7.4.160.0150.00216.71
7.4.150.0110.00717.40
7.4.140.0080.01017.86
7.4.130.0090.00816.85
7.4.120.0100.00716.91
7.4.110.0100.00716.86
7.4.100.0070.01016.94
7.4.90.0150.00316.70
7.4.80.0100.00719.39
7.4.70.0090.00916.70
7.4.60.0090.01516.76
7.4.50.0050.00516.67
7.4.40.0040.01122.77
7.4.30.0170.00016.93
7.4.00.0040.01115.39
7.3.330.0000.00613.45
7.3.320.0030.00313.59
7.3.310.0040.00416.65
7.3.300.0000.00716.49
7.3.290.0000.02116.58
7.3.280.0060.01016.63
7.3.270.0030.01517.40
7.3.260.0110.00616.79
7.3.250.0090.00916.59
7.3.240.0060.01116.69
7.3.230.0170.00016.75
7.3.210.0070.01016.76
7.3.200.0120.00619.39
7.3.190.0140.00616.62
7.3.180.0060.01316.79
7.3.170.0100.01316.90
7.3.160.0060.01616.91
7.3.120.0100.00614.98
7.3.10.0140.00016.83
7.3.00.0030.00916.72
7.2.330.0080.00816.83
7.2.320.0090.00916.94
7.2.310.0080.00817.00
7.2.300.0080.00816.80
7.2.290.0070.01017.04
7.2.130.0030.01016.91
7.2.120.0060.00617.18
7.2.110.0070.01017.17
7.2.100.0040.00717.11
7.2.90.0100.00317.13
7.2.80.0060.00617.38
7.2.70.0030.00717.28
7.2.60.0070.00717.04
7.2.50.0070.00717.22
7.2.40.0030.00717.04
7.2.30.0030.00716.96
7.2.20.0040.00817.12
7.2.10.0040.00817.09
7.2.00.0030.00818.38
7.1.250.0030.01015.90
7.1.200.0160.00416.02
7.1.70.0030.00717.39
7.1.60.0080.00517.20
7.1.50.0100.00616.98
7.1.00.0100.06722.59
7.0.200.0000.00716.94
7.0.140.0030.07322.21
7.0.60.0030.08320.03
7.0.50.0070.08018.02
7.0.40.0200.07020.42
7.0.30.0470.05020.09
7.0.20.0230.04720.25
7.0.10.0270.03020.07
7.0.00.0100.03720.13
5.6.280.0030.07320.94
5.6.210.0030.04320.61
5.6.200.0070.05018.19
5.6.190.0030.09020.61
5.6.180.0200.08720.60
5.6.170.0200.04020.46
5.6.160.0070.08320.50
5.6.150.0070.07718.18
5.6.140.0030.08018.15
5.6.130.0030.06318.14
5.6.120.0170.04721.02
5.6.110.0100.09320.99
5.6.100.0170.07321.14
5.6.90.0070.07721.05
5.6.80.0130.07320.42
5.6.70.0300.06720.38
5.5.350.0300.08020.45
5.5.340.0030.04017.99
5.5.330.0070.04020.40
5.5.320.0230.06720.38
5.5.310.0300.07320.20
5.5.300.0100.07718.08
5.5.290.0030.04318.01
5.5.280.0070.04020.90
5.5.270.0030.05320.95
5.5.260.0100.08320.81
5.5.250.0070.08020.51
5.5.240.0100.05720.05
5.4.450.0300.08019.39
5.4.440.0270.06319.54
5.4.430.0200.05719.51
5.4.420.0200.05319.51
5.4.410.0130.05018.74
5.4.400.0700.00018.88
5.4.390.0900.00018.52
5.4.380.0230.05318.46
5.4.370.0170.06718.79
5.4.360.0170.05718.60
5.4.350.0230.05018.74
5.4.340.0300.04718.63
5.4.320.0110.03412.52
5.4.310.0020.04212.52
5.4.300.0060.03712.52
5.4.290.0050.03912.51
5.4.280.0060.04412.41
5.4.270.0070.03512.41
5.4.260.0100.03612.41
5.4.250.0060.04312.41
5.4.240.0080.03412.41
5.4.230.0070.03612.41
5.4.220.0110.04612.40
5.4.210.0070.08018.84
5.4.200.0100.05319.00
5.4.190.0130.07018.78
5.4.180.0070.06318.65
5.4.170.0070.05719.00
5.4.160.0100.05318.92
5.4.150.0100.06018.63
5.4.140.0070.07316.48
5.4.130.0130.06716.36
5.4.120.0030.06016.38
5.4.110.0130.06016.55
5.4.100.0230.04316.54
5.4.90.0100.05316.71
5.4.80.0070.05316.45
5.4.70.0100.07316.66
5.4.60.0100.06716.47
5.4.50.0130.05316.62
5.4.40.0170.06016.54
5.4.30.0100.06316.62
5.4.20.0330.04716.34
5.4.10.0100.06716.35
5.4.00.0030.05715.78
5.3.290.0080.04312.80
5.3.280.0050.04012.72
5.3.270.0130.05314.60
5.3.260.0100.05714.55
5.3.250.0100.06314.63
5.3.240.0130.04714.73
5.3.230.0100.05014.79
5.3.220.0130.05014.68
5.3.210.0100.07714.73
5.3.200.0070.05014.60
5.3.190.0100.06014.62
5.3.180.0100.07314.66
5.3.170.0100.06314.66
5.3.160.0200.05714.76
5.3.150.0170.06714.68
5.3.140.0100.07314.66
5.3.130.0130.06014.55
5.3.120.0230.06014.58
5.3.110.0070.05014.68
5.3.100.0100.04714.26
5.3.90.0130.04314.13
5.3.80.0130.04313.94
5.3.70.0130.06014.04
5.3.60.0100.07013.85
5.3.50.0230.05013.96
5.3.40.0070.07014.05
5.3.30.0170.04014.10
5.3.20.0030.05013.80
5.3.10.0070.04713.66
5.3.00.0070.05013.76
5.2.170.0100.04711.24
5.2.160.0030.04311.00
5.2.150.0030.04311.14
5.2.140.0100.05311.23
5.2.130.0030.04311.21
5.2.120.0070.04311.35
5.2.110.0000.04711.03
5.2.100.0070.04011.10
5.2.90.0030.06011.03
5.2.80.0100.03711.28
5.2.70.0070.04011.07
5.2.60.0000.04711.24
5.2.50.0130.04710.90
5.2.40.0070.03711.04
5.2.30.0100.05311.23
5.2.20.0070.04311.08
5.2.10.0070.04711.07
5.2.00.0100.05010.92
5.1.60.0070.0439.87
5.1.50.0030.03310.10
5.1.40.0030.03310.11
5.1.30.0000.04010.45
5.1.20.0030.04310.56
5.1.10.0030.03310.02
5.1.00.0070.03310.17
5.0.50.0000.0338.82
5.0.40.0100.0278.52
5.0.30.0030.0478.36
5.0.20.0000.0308.07
5.0.10.0100.0278.21
5.0.00.0070.0378.04
4.4.90.0000.0237.11
4.4.80.0070.0237.11
4.4.70.0030.0277.11
4.4.60.0000.0237.11
4.4.50.0000.0337.11
4.4.40.0100.0307.11
4.4.30.0000.0237.11
4.4.20.0030.0207.11
4.4.10.0030.0207.11
4.4.00.0070.0307.11
4.3.110.0000.0307.11
4.3.100.0070.0207.11
4.3.90.0130.0107.11
4.3.80.0030.0307.11
4.3.70.0100.0237.11
4.3.60.0000.0237.11
4.3.50.0070.0207.11
4.3.40.0070.0307.07
4.3.30.0000.0277.03
4.3.20.0030.0237.03
4.3.10.0000.0237.03
4.3.00.0130.0236.83

preferences:
44.69 ms | 401 KiB | 5 Q