3v4l.org

run code in 300+ PHP versions simultaneously
<?php $r = array('hoge'=> new \stdClass()); $j = json_serialize($r); echo $j . "\n"; print_r(json_unserialize($j)); echo "\n"; function json_serialize($any) { return json_encode(json_wrap($any)); } function json_unserialize($str) { return json_unwrap(json_decode($str)); } function json_wrap($any, $skipAssoc = false) { if (!$skipAssoc && is_array($any) && is_string(key($any))) { return (object)array("_PHP_ASSOC" => json_wrap($any,true)); } if (is_array($any) || is_object($any)) { foreach ($any as &$v) { $v = json_wrap($v); } } return $any; } function json_unwrap($any, $skipAssoc = false) { if (!$skipAssoc && is_object($any) && is_object($any->_PHP_ASSOC) && count((array)$any) == 1) { return (array)json_unwrap($any->_PHP_ASSOC); } if (is_array($any) || is_object($any)) { foreach ($any as &$v) { $v = json_unwrap($v); } } return $any; }

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.0030.01616.75
8.3.50.0110.00722.00
8.3.40.0000.01418.94
8.3.30.0110.00419.10
8.3.20.0040.00420.25
8.3.10.0080.00021.80
8.3.00.0070.00320.84
8.2.180.0190.00316.63
8.2.170.0100.00322.96
8.2.160.0070.00720.38
8.2.150.0060.00324.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0040.00419.95
8.2.110.0060.00320.92
8.2.100.0110.00017.75
8.2.90.0040.00419.36
8.2.80.0040.00417.97
8.2.70.0060.00317.63
8.2.60.0000.00818.05
8.2.50.0060.00318.07
8.2.40.0050.00318.34
8.2.30.0000.00718.22
8.2.20.0000.00817.78
8.2.10.0040.00418.04
8.2.00.0000.00817.71
8.1.280.0160.00625.92
8.1.270.0130.00320.59
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0000.00922.21
8.1.230.0040.00819.07
8.1.220.0050.00317.74
8.1.210.0000.00818.77
8.1.200.0030.00617.23
8.1.190.0000.00817.36
8.1.180.0040.00418.10
8.1.170.0050.00320.14
8.1.160.0040.00422.04
8.1.150.0040.00418.93
8.1.140.0040.00417.55
8.1.130.0030.00317.73
8.1.120.0000.00817.40
8.1.110.0030.00617.47
8.1.100.0040.00417.37
8.1.90.0040.00417.43
8.1.80.0080.00017.41
8.1.70.0040.00417.53
8.1.60.0040.00417.62
8.1.50.0040.00417.59
8.1.40.0030.00517.56
8.1.30.0040.00417.52
8.1.20.0080.00017.57
8.1.10.0000.00817.56
8.1.00.0030.00617.45
8.0.300.0040.00418.77
8.0.290.0060.00316.63
8.0.280.0030.00318.39
8.0.270.0040.00417.16
8.0.260.0000.00817.25
8.0.250.0050.00217.05
8.0.240.0000.00717.12
8.0.230.0040.00417.01
8.0.220.0040.00417.04
8.0.210.0070.00017.04
8.0.200.0040.00417.03
8.0.190.0030.00517.06
8.0.180.0070.00016.98
8.0.170.0040.00417.05
8.0.160.0000.00717.09
8.0.150.0050.00217.01
8.0.140.0080.00016.96
8.0.130.0080.00013.46
8.0.120.0040.00416.95
8.0.110.0000.00717.01
8.0.100.0040.00416.94
8.0.90.0000.00716.81
8.0.80.0090.00617.04
8.0.70.0000.00817.05
8.0.60.0040.00416.99
8.0.50.0030.00516.86
8.0.30.0070.01417.06
8.0.20.0170.02017.40
8.0.10.0040.00416.96
8.0.00.0090.01216.81
7.4.330.0050.00015.09
7.4.320.0030.00316.55
7.4.300.0030.00316.61
7.4.290.0030.00316.64
7.4.280.0000.00916.54
7.4.270.0050.00216.54
7.4.260.0040.00416.58
7.4.250.0000.00716.54
7.4.240.0020.00516.57
7.4.230.0030.00316.34
7.4.220.0120.00616.64
7.4.210.0090.00616.57
7.4.200.0000.00716.66
7.4.160.0120.00316.46
7.4.150.0120.00617.40
7.4.140.0080.01217.86
7.4.130.0110.00716.61
7.4.120.0100.01016.71
7.4.110.0070.01316.59
7.4.100.0060.01316.49
7.4.90.0070.01016.62
7.4.80.0130.00316.65
7.4.70.0110.00716.64
7.4.60.0130.00316.41
7.4.50.0030.00616.43
7.4.40.0090.00616.68
7.4.30.0100.01016.69
7.4.00.0090.00615.02
7.3.330.0030.00313.42
7.3.320.0120.00013.43
7.3.310.0000.00716.51
7.3.300.0000.00616.33
7.3.290.0030.00316.27
7.3.280.0100.00616.43
7.3.270.0060.01217.40
7.3.260.0100.00716.63
7.3.250.0070.01016.53
7.3.240.0100.00716.64
7.3.230.0080.00916.45
7.3.210.0030.01316.39
7.3.200.0060.01319.39
7.3.190.0060.01016.59
7.3.180.0060.00916.40
7.3.170.0110.00816.36
7.3.160.0140.00816.59
7.3.10.0160.00516.71
7.3.00.0140.00716.51
7.2.330.0070.01116.55
7.2.320.0150.00416.77
7.2.310.0060.01616.80
7.2.300.0000.01816.49
7.2.290.0090.00916.61
7.2.130.0120.00716.91
7.2.120.0120.00716.90
7.2.110.0140.00516.76
7.2.100.0140.00516.79
7.2.90.0120.00716.66
7.2.80.0130.00516.57
7.2.70.0110.01216.76
7.2.60.0110.00616.88
7.2.50.0140.00816.74
7.2.40.0090.00916.72
7.2.30.0150.00916.90
7.2.20.0120.01016.74
7.2.10.0140.00716.60
7.2.00.0100.01017.69
7.1.250.0080.01015.51
7.1.200.0070.00715.77
7.1.100.0100.00618.25
7.1.70.0040.00417.18
7.1.60.0090.01219.46
7.1.50.0000.01416.98
7.1.00.0000.08022.48
7.0.200.0710.00714.50
7.0.140.0030.06322.00
7.0.90.0130.07019.90
7.0.80.0070.08319.85
7.0.70.0070.08319.82
7.0.60.0030.05020.03
7.0.50.0130.08020.32
7.0.40.0130.08020.00
7.0.30.0030.05720.07
7.0.20.0070.08720.14
7.0.10.0100.03720.04
7.0.00.0000.09019.99
5.6.280.0000.07321.02
5.6.230.0100.07320.63
5.6.220.0000.09020.60
5.6.210.0070.07720.54
5.6.200.0100.08321.18
5.6.190.0170.07021.04
5.6.180.0030.08721.11
5.6.170.0130.07721.14
5.6.160.0130.08020.96
5.6.150.0170.08021.11
5.6.140.0130.07721.05
5.6.130.0000.08721.02
5.6.120.0100.08021.05
5.6.110.0070.04321.17
5.6.100.0070.05021.07
5.6.90.0130.05021.09
5.6.80.0030.04320.35
5.6.70.0130.07020.42
5.6.60.0130.07320.28
5.6.50.0070.04720.46
5.6.40.0100.05020.48
5.6.30.0130.07020.41
5.6.20.0070.08020.37
5.6.10.0070.05320.36
5.6.00.0130.07320.38
5.5.370.0070.07720.37
5.5.360.0130.07720.46
5.5.350.0170.08020.38
5.5.340.0070.08320.77
5.5.330.0000.09020.90
5.5.320.0130.08320.63
5.5.310.0130.03720.88
5.5.300.0030.07720.88
5.5.290.0130.07320.93
5.5.280.0070.08320.93
5.5.270.0070.04020.87
5.5.260.0000.09720.90
5.5.250.0100.03720.73
5.5.240.0070.05020.19
5.5.230.0000.05320.31
5.5.220.0100.07320.18
5.5.210.0030.08720.14
5.5.200.0130.07320.00
5.5.190.0100.05320.24
5.5.180.0170.06020.25
5.5.160.0030.06020.09
5.5.150.0000.09020.26
5.5.140.0100.07320.18
5.5.130.0100.08020.27
5.5.120.0100.04320.24
5.5.110.0030.06320.23
5.5.100.0070.08019.96
5.5.90.0100.06320.10
5.5.80.0000.08020.05
5.5.70.0070.05320.05
5.5.60.0070.03720.01
5.5.50.0100.08019.97
5.5.40.0070.08020.02
5.5.30.0070.04320.10
5.5.20.0070.04720.14
5.5.10.0070.05020.05
5.5.00.0100.07019.95
5.4.450.0070.07719.49
5.4.440.0100.07019.49
5.4.430.0070.05319.55
5.4.420.0030.06319.44
5.4.410.0070.03719.38
5.4.400.0070.08319.23
5.4.390.0100.07319.03
5.4.380.0130.03319.23
5.4.370.0070.04319.05
5.4.360.0030.07719.03
5.4.350.0070.04719.18
5.4.340.0030.08319.12
5.4.320.0130.07719.07
5.4.310.0070.07018.85
5.4.300.0000.07318.90
5.4.290.0070.08019.03
5.4.280.0100.07719.13
5.4.270.0030.08019.04
5.4.260.0070.07319.00
5.4.250.0070.07718.95
5.4.240.0070.04319.22
5.4.230.0100.07719.15
5.4.220.0070.07019.11
5.4.210.0100.07319.00
5.4.200.0000.07719.11
5.4.190.0000.05019.08
5.4.180.0070.07719.02
5.4.170.0100.04318.86
5.4.160.0070.04319.02
5.4.150.0100.04019.10
5.4.140.0100.04016.48
5.4.130.0000.08016.41
5.4.120.0100.07016.44
5.4.110.0100.06016.45
5.4.100.0130.06316.39
5.4.90.0070.07316.58
5.4.80.0070.04016.37
5.4.70.0030.07716.54
5.4.60.0070.07316.25
5.4.50.0130.06716.44
5.4.40.0070.07316.42
5.4.30.0000.06716.33
5.4.20.0100.06316.37
5.4.10.0100.07016.44
5.4.00.0030.05715.80
5.3.290.0200.06714.63
5.3.280.0030.08014.73
5.3.270.0100.04314.55
5.3.260.0030.05714.64
5.3.250.0030.06314.61
5.3.240.0130.04314.73
5.3.230.0070.07314.64
5.3.220.0030.07714.54
5.3.210.0100.07314.70
5.3.200.0100.06314.59
5.3.190.0070.07314.52
5.3.180.0100.05714.65
5.3.170.0070.04014.58
5.3.160.0200.06714.64
5.3.150.0070.06014.71
5.3.140.0030.06714.55
5.3.130.0030.07714.48
5.3.120.0030.08014.53
5.3.110.0130.06314.54
5.3.100.0070.04713.98
5.3.90.0100.07014.09
5.3.80.0070.06014.06
5.3.70.0100.05714.08
5.3.60.0100.06314.07
5.3.50.0130.06314.07
5.3.40.0070.07714.07
5.3.30.0030.07713.83
5.3.20.0100.06313.63
5.3.10.0100.06713.72
5.3.00.0000.06013.57
5.2.170.0100.06311.23
5.2.160.0070.03311.17
5.2.150.0000.03311.27
5.2.140.0070.06311.19
5.2.130.0030.03711.02
5.2.120.0030.06011.25
5.2.110.0070.06311.13
5.2.100.0070.04011.17
5.2.90.0070.06311.13
5.2.80.0130.04711.12
5.2.70.0070.06311.16
5.2.60.0130.05711.13
5.2.50.0030.06311.02
5.2.40.0070.06010.91
5.2.30.0030.03710.98
5.2.20.0070.06010.92
5.2.10.0100.05710.88
5.2.00.0030.06010.81
5.1.60.0000.05710.10
5.1.50.0030.05310.00
5.1.40.0030.04310.08
5.1.30.0070.03010.48
5.1.20.0130.05310.47
5.1.10.0070.03010.16
5.1.00.0000.02710.17
5.0.50.0030.0208.56
5.0.40.0000.0308.42
5.0.30.0070.0308.41
5.0.20.0000.0238.41
5.0.10.0000.0238.41
5.0.00.0000.0308.41
4.4.90.0000.0378.41
4.4.80.0070.0338.41
4.4.70.0000.0338.41
4.4.60.0000.0378.41
4.4.50.0030.0338.41
4.4.40.0070.0278.41
4.4.30.0030.0338.41
4.4.20.0070.0278.41
4.4.10.0000.0278.41
4.4.00.0030.0278.41
4.3.110.0000.0238.41
4.3.100.0070.0138.41
4.3.90.0030.0138.41
4.3.80.0000.0238.41
4.3.70.0000.0178.41
4.3.60.0030.0138.41
4.3.50.0000.0178.41
4.3.40.0000.0238.41
4.3.30.0030.0178.41
4.3.20.0030.0138.41
4.3.10.0000.0178.41
4.3.00.0000.0178.41

preferences:
71.46 ms | 401 KiB | 5 Q