3v4l.org

run code in 300+ PHP versions simultaneously
<?php function formaldehyde_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.70.0100.01016.75
8.3.60.0060.01018.66
8.3.50.0150.00721.92
8.3.40.0040.01118.94
8.3.30.0110.00319.04
8.3.20.0050.00320.19
8.3.10.0080.00022.05
8.3.00.0080.00022.52
8.2.190.0070.01016.63
8.2.180.0120.00618.28
8.2.170.0110.00422.96
8.2.160.0110.00320.93
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0040.00419.23
8.2.110.0080.00022.13
8.2.100.0070.00417.91
8.2.90.0000.00819.23
8.2.80.0050.00317.97
8.2.70.0000.00817.75
8.2.60.0000.00918.04
8.2.50.0030.00618.07
8.2.40.0030.00618.34
8.2.30.0000.00718.07
8.2.20.0040.00417.65
8.2.10.0040.00419.47
8.2.00.0040.00417.73
8.1.280.0070.00725.92
8.1.270.0000.00722.11
8.1.260.0090.00026.35
8.1.250.0080.00028.09
8.1.240.0090.00024.02
8.1.230.0070.00419.14
8.1.220.0030.00517.79
8.1.210.0040.00418.77
8.1.200.0060.00617.35
8.1.190.0030.00517.51
8.1.180.0000.00918.56
8.1.170.0000.00818.44
8.1.160.0000.00821.89
8.1.150.0000.00718.48
8.1.140.0050.00217.41
8.1.130.0030.00317.80
8.1.120.0000.00717.42
8.1.110.0000.00817.31
8.1.100.0000.00717.37
8.1.90.0000.00717.42
8.1.80.0040.00417.37
8.1.70.0070.00017.35
8.1.60.0060.00317.54
8.1.50.0030.00617.47
8.1.40.0080.00017.43
8.1.30.0000.00717.61
8.1.20.0030.00517.66
8.1.10.0050.00217.68
8.1.00.0030.00617.57
8.0.300.0060.00318.77
8.0.290.0040.00417.16
8.0.280.0070.00018.38
8.0.270.0080.00017.13
8.0.260.0000.00716.95
8.0.250.0030.00317.00
8.0.240.0000.00716.97
8.0.230.0040.00416.80
8.0.220.0040.00416.82
8.0.210.0000.00816.81
8.0.200.0030.00316.99
8.0.190.0080.00017.02
8.0.180.0000.00716.83
8.0.170.0040.00416.84
8.0.160.0020.00516.85
8.0.150.0000.00716.88
8.0.140.0000.00716.81
8.0.130.0000.00513.38
8.0.120.0050.00216.83
8.0.110.0030.00616.93
8.0.100.0030.00516.70
8.0.90.0040.00416.81
8.0.80.0110.00816.79
8.0.70.0030.00516.89
8.0.60.0040.00416.89
8.0.50.0000.00716.71
8.0.30.0140.00617.12
8.0.20.0140.01217.40
8.0.10.0000.00716.83
8.0.00.0110.00816.83
7.4.330.0000.00515.00
7.4.320.0060.00016.47
7.4.300.0000.00716.43
7.4.290.0070.00016.48
7.4.280.0040.00416.55
7.4.270.0030.00716.43
7.4.260.0040.00416.41
7.4.250.0000.00816.58
7.4.240.0030.00516.53
7.4.230.0030.00316.56
7.4.220.0090.00916.64
7.4.210.0050.01016.56
7.4.200.0040.00416.52
7.4.190.0040.00416.72
7.4.160.0070.01016.52
7.4.150.0150.00317.40
7.4.140.0150.00417.86
7.4.130.0110.00716.58
7.4.120.0140.00316.53
7.4.110.0120.00616.60
7.4.100.0090.00916.64
7.4.90.0030.01416.43
7.4.80.0030.01919.39
7.4.70.0100.00716.68
7.4.60.0060.01016.63
7.4.50.0060.00316.60
7.4.40.0110.00722.77
7.4.30.0080.00816.71
7.4.00.0000.01714.76
7.3.330.0060.00013.17
7.3.320.0000.00513.24
7.3.310.0070.00016.41
7.3.300.0040.00416.39
7.3.290.0100.00716.32
7.3.280.0030.01216.38
7.3.270.0130.01017.40
7.3.260.0080.01116.39
7.3.250.0070.01016.48
7.3.240.0060.01116.28
7.3.230.0070.01016.39
7.3.210.0090.00916.55
7.3.200.0070.01019.39
7.3.190.0080.01516.29
7.3.180.0070.01016.39
7.3.170.0180.00416.41
7.3.160.0110.01116.48
7.3.120.0070.01015.07
7.2.330.0100.00716.61
7.2.320.0110.00716.75
7.2.310.0070.01116.74
7.2.300.0060.01016.70
7.2.290.0120.00316.53
7.2.60.0000.01416.99
7.2.00.0000.01219.13
7.1.200.0080.00315.82
7.1.100.0060.00618.27
7.1.70.0000.00917.21
7.1.60.0070.01619.82
7.1.50.0030.02217.09
7.1.00.0130.06722.38
7.0.200.0100.00316.50
7.0.140.0030.07021.99
7.0.60.0030.07320.01
7.0.50.0070.06017.86
7.0.40.0030.04320.23
7.0.30.0530.05020.07
7.0.20.0100.05020.21
7.0.10.0300.04020.08
7.0.00.0070.05320.22
5.6.280.0030.07321.05
5.6.210.0030.07720.52
5.6.200.0070.08018.16
5.6.190.0130.07720.52
5.6.180.4200.04320.55
5.6.170.0270.07320.66
5.6.160.0000.09720.50
5.6.150.0070.04318.14
5.6.140.0070.07018.14
5.6.130.0030.05318.14
5.6.120.0030.04020.96
5.6.110.0270.07021.13
5.6.100.0070.05021.12
5.6.90.0000.08020.89
5.6.80.0130.04720.54
5.6.70.4670.04020.54
5.5.350.0130.03320.40
5.5.340.0070.06717.99
5.5.330.0000.04720.48
5.5.320.0330.05320.34
5.5.310.0200.03720.27
5.5.300.0030.04017.99
5.5.290.0130.03717.98
5.5.280.0100.06720.80
5.5.270.0030.07320.88
5.5.260.0130.07320.87
5.5.250.0100.04720.56
5.5.240.0070.07720.13
5.4.450.0370.04719.17
5.4.440.0830.05019.20
5.4.430.0230.06719.45
5.4.420.0070.06019.56
5.4.410.0170.05319.45
5.4.400.0770.00018.67
5.4.390.0770.00018.70
5.4.380.0170.06318.76
5.4.370.0400.04318.62
5.4.360.0300.05018.76
5.4.350.0170.05718.63
5.4.340.0300.06318.57
5.4.320.0050.04412.51
5.4.310.0090.04312.50
5.4.300.0060.04212.51
5.4.290.0050.04412.51
5.4.280.0080.04112.41
5.4.270.0080.03512.41
5.4.260.0070.03912.40
5.4.250.0080.03912.41
5.4.240.0080.03512.40
5.4.230.0070.03912.40
5.4.220.0090.04512.40
5.4.210.0090.03212.40
5.4.200.0060.04012.40
5.4.190.0100.05018.76
5.4.180.0100.05319.09
5.4.170.0100.05018.83
5.4.160.0030.05318.98
5.4.150.0070.05318.89
5.4.140.0070.07716.35
5.4.130.0130.04716.39
5.4.120.0130.04316.43
5.4.110.0130.06716.48
5.4.100.0000.05316.48
5.4.90.0030.07716.50
5.4.80.0030.05716.32
5.4.70.0100.05016.60
5.4.60.0130.04316.48
5.4.50.0070.05016.51
5.4.40.0130.06316.49
5.4.30.0100.06316.59
5.4.20.0030.05316.51
5.4.10.0070.05316.46
5.4.00.0100.04715.82
5.3.290.0070.04512.80
5.3.280.0070.04012.71
5.3.270.0070.05314.59
5.3.260.0130.05314.70
5.3.250.0000.07014.52
5.3.240.0070.06714.75
5.3.230.0130.04314.71
5.3.220.0000.06014.58
5.3.210.0130.04714.76
5.3.200.0030.05714.72
5.3.190.0070.05014.59
5.3.180.0130.07014.64
5.3.170.0130.07314.57
5.3.160.0070.05014.71
5.3.150.0100.05014.57
5.3.140.0100.05714.59
5.3.130.0130.06714.79
5.3.120.0070.05314.47
5.3.110.0100.05014.55
5.3.100.0170.04314.13
5.3.90.0130.05713.86
5.3.80.0130.04314.12
5.3.70.0070.06314.02
5.3.60.0100.04714.03
5.3.50.0030.05313.80
5.3.40.0100.04714.18
5.3.30.0100.04714.10
5.3.20.0070.05313.91
5.3.10.0100.04313.65
5.3.00.0030.05713.73
5.2.170.0030.04311.01
5.2.160.0000.04311.24
5.2.150.0070.04311.32
5.2.140.0100.03710.99
5.2.130.0070.04011.20
5.2.120.0030.04011.11
5.2.110.0030.04011.20
5.2.100.0070.03711.11
5.2.90.0000.06011.20
5.2.80.0100.05011.17
5.2.70.0030.04311.28
5.2.60.0070.04010.98
5.2.50.0170.05011.23
5.2.40.0070.04010.92
5.2.30.0000.05311.05
5.2.20.0070.04010.96
5.2.10.0000.06011.05
5.2.00.0030.04010.82
5.1.60.0000.04310.11
5.1.50.0100.0439.93
5.1.40.0100.03010.00
5.1.30.0100.04710.30
5.1.20.0030.04710.46
5.1.10.0070.03710.07
5.1.00.0030.03710.33
5.0.50.0070.0308.63
5.0.40.0030.0278.28
5.0.30.0030.0478.45
5.0.20.0000.0308.22
5.0.10.0000.0308.18
5.0.00.0030.0408.02
4.4.90.0030.0236.93
4.4.80.0030.0206.93
4.4.70.0000.0236.93
4.4.60.0000.0236.93
4.4.50.0000.0236.93
4.4.40.0000.0376.93
4.4.30.0030.0306.93
4.4.20.0070.0176.93
4.4.10.0000.0236.93
4.4.00.0030.0336.93
4.3.110.0030.0206.93
4.3.100.0000.0236.93
4.3.90.0000.0236.93
4.3.80.0030.0306.93
4.3.70.0030.0176.93
4.3.60.0070.0176.93
4.3.50.0070.0206.93
4.3.40.0000.0376.93
4.3.30.0030.0206.93
4.3.20.0000.0276.93
4.3.10.0030.0206.93
4.3.00.0070.01313.22

preferences:
35.86 ms | 401 KiB | 5 Q