3v4l.org

run code in 300+ PHP versions simultaneously
<?php class testClass_forSerialize implements Serializable { public function serialize() { static $count = 0; static $objectHashes = []; $ret = new \stdClass(); $serializedData = serialize($ret); $objectHash = spl_object_hash($ret); echo "loop $count: ObjectHash $objectHash Received: ".$serializedData."\n"; if (array_key_exists($objectHash, $objectHashes) == true) { echo "Object hash already exists - serialize is going to be sad.\n"; } $objectHashes[$objectHash] = $count; if (@unserialize($serializedData) === false) { printf( "borked, serialize of %s returned %s which could not be unserialized.\n", var_export($ret, true), $serializedData ); exit(0); } echo "loop $count: Returning '$serializedData'\n"; $count++; return $serializedData; } public function unserialize($data) { throw new \Exception("not relevant"); } } $list = []; for ($i=0; $i<2; $i++) { $list[] = new \testClass_forSerialize(); } $ser = serialize($list);
based on 7vCcn

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.0.30.0110.00816.98
8.0.20.0090.00917.40
8.0.00.0100.01016.85
7.4.150.0070.01117.40
7.4.140.0100.01017.86
7.4.130.0080.01016.65
7.4.120.0090.00816.59
7.4.110.0120.01416.64
7.4.100.0200.00416.69
7.4.90.0110.00716.54
7.4.80.0170.00319.39
7.4.70.0110.01116.64
7.4.60.0130.00316.64
7.4.50.0030.00616.40
7.4.40.0090.00916.36
7.4.30.0130.01016.61
7.4.10.0060.00615.29
7.4.00.0050.01214.85
7.3.270.0120.00617.40
7.3.260.0140.00916.53
7.3.250.0110.00816.50
7.3.240.0080.00816.44
7.3.230.0070.01316.67
7.3.210.0100.00616.37
7.3.200.0150.00619.39
7.3.190.0050.01416.40
7.3.180.0030.01916.33
7.3.170.0130.00616.45
7.3.160.0120.00616.55
7.3.130.0090.00914.89
7.3.120.0050.01114.82
7.3.110.0080.00915.01
7.3.100.0070.00614.81
7.3.90.0090.00514.98
7.3.80.0080.00915.00
7.3.70.0080.00815.02
7.3.60.0070.00414.96
7.3.50.0030.01014.96
7.3.40.0040.01014.96
7.3.30.0080.00614.79
7.3.20.0040.01016.70
7.3.10.0100.00516.38
7.3.00.0080.00816.49
7.2.330.0170.00316.45
7.2.320.0140.00416.64
7.2.310.0090.01216.82
7.2.300.0090.00916.77
7.2.290.0090.00916.78
7.2.260.0070.01115.05
7.2.250.0080.01014.94
7.2.240.0060.01115.13
7.2.230.0050.00815.32
7.2.220.0070.00715.16
7.2.210.0110.00815.23
7.2.200.0030.01014.97
7.2.190.0040.00914.96
7.2.180.0090.00515.13
7.2.170.0030.01114.98
7.2.160.0100.00315.03
7.2.150.0100.00716.75
7.2.140.0060.01216.89
7.2.130.0120.00816.55
7.2.120.0070.01416.65
7.2.110.0110.00616.64
7.2.100.0110.01016.73
7.2.90.0060.01016.74
7.2.80.0090.01116.55
7.2.70.0110.01016.56
7.2.60.0040.01016.79
7.2.50.0100.01016.90
7.2.40.0090.01116.90
7.2.30.0140.00716.70
7.2.20.0100.00816.65
7.2.10.0100.00716.77
7.2.00.0120.00617.61
7.1.330.0030.01015.56
7.1.320.0030.01015.78
7.1.310.0030.00615.77
7.1.300.0060.00715.84
7.1.290.0050.01115.76
7.1.280.0090.00415.70
7.1.270.0060.00715.71
7.1.260.0090.00415.60
7.1.250.0110.00515.47
7.1.240.0120.00616.00
7.1.230.0080.01115.84
7.1.220.0100.00715.49
7.1.210.0040.00815.93
7.1.200.0040.01015.79
7.1.190.0030.00715.94
7.1.180.0100.00315.72
7.1.170.0070.00715.83
7.1.160.0060.00915.76
7.1.150.0030.00915.55
7.1.140.0090.00315.75
7.1.130.0030.00715.83
7.1.120.0060.00315.90
7.1.110.0000.01716.01
7.1.100.0040.01116.86
7.1.90.0070.01015.56
7.1.80.0090.00615.79
7.1.70.0050.00616.54
7.1.60.0060.01317.74
7.1.50.0050.01616.35
7.1.40.0040.01415.77
7.1.30.0060.00615.61
7.1.20.0060.01015.70
7.1.10.0060.00915.57
7.1.00.0080.04019.10
7.0.330.0000.01315.27
7.0.320.0150.00015.07
7.0.310.0060.00615.18
7.0.300.0030.01015.46
7.0.290.0100.00315.39
7.0.280.0000.01215.30
7.0.270.0070.00715.25
7.0.260.0090.00315.34
7.0.250.0070.01015.45
7.0.240.0040.00815.53
7.0.230.0030.01415.39
7.0.220.0060.01015.40
7.0.210.0030.01315.21
7.0.200.0030.00815.96
7.0.190.0100.00315.39
7.0.180.0090.00915.49
7.0.170.0090.00615.50
7.0.160.0080.00615.36
7.0.150.0100.00615.47
7.0.140.0090.00615.55
7.0.130.0030.01015.29
7.0.120.0100.00415.42
7.0.110.0070.01015.07
7.0.100.0030.01015.51
7.0.90.0080.00615.09
7.0.80.0100.00315.54
7.0.70.0100.00315.39
7.0.60.0080.04017.70
7.0.50.0080.04016.72
7.0.40.0050.02516.69
7.0.30.0150.02316.72
7.0.20.0170.04216.75
7.0.10.0090.02216.81
7.0.00.0130.03316.90
5.6.400.0000.01514.25
5.6.390.0070.00714.12
5.6.380.0000.01514.32
5.6.370.0030.01014.36
5.6.360.0060.00614.48
5.6.350.0040.00814.11
5.6.340.0070.00714.59
5.6.330.0080.00414.50
5.6.320.0100.00414.77
5.6.310.0060.00914.44
5.6.300.0090.00614.48
5.6.290.0060.01214.69
5.6.280.0020.04117.80
5.6.270.0060.00914.56
5.6.260.0090.00614.56
5.6.250.0060.00914.40
5.6.240.0030.00914.36
5.6.230.0040.01114.50
5.6.220.0060.00614.36
5.6.210.0070.04417.51
5.6.200.0020.05116.35
5.6.190.0100.04317.60
5.6.180.0210.04017.55
5.6.170.0200.02517.40
5.6.160.0020.02817.43
5.6.150.0070.03516.21
5.6.140.0100.03716.24
5.6.130.0050.04416.26
5.6.120.0030.02617.64
5.6.110.0100.04517.72
5.6.100.0070.02917.62
5.6.90.0120.04517.63
5.6.80.0100.04117.29
5.6.70.0060.00814.07
5.6.60.0080.00414.66
5.6.50.0070.01014.57
5.6.40.0110.00014.16
5.6.30.0000.01214.49
5.6.20.0000.01414.52
5.6.10.0040.01114.27
5.6.00.0030.01014.21
5.5.380.0070.00714.51
5.5.370.0000.01814.26
5.5.360.0040.00814.33
5.5.350.0100.05017.51
5.5.340.0030.04516.09
5.5.330.0080.04617.24
5.5.320.0080.02617.32
5.5.310.0150.02317.38
5.5.300.0080.03016.26
5.5.290.0030.02516.39
5.5.280.0160.02717.65
5.5.270.0050.03017.62
5.5.260.0130.03817.88
5.5.250.0080.04517.59
5.5.240.0020.02617.21
5.5.230.0170.00014.45
5.5.220.0100.00714.14
5.5.210.0060.00614.10
5.5.200.0030.00914.57
5.5.190.0030.01314.52
5.5.180.0070.00314.46
5.5.170.0090.00614.37
5.5.160.0030.01314.17
5.5.150.0090.00914.28
5.5.140.0040.00714.24
5.5.130.0080.00814.23
5.5.120.0040.00814.29
5.5.110.0030.01014.42
5.5.100.0000.01014.48
5.5.90.0040.01214.26
5.5.80.0000.01414.09
5.5.70.0070.01014.05
5.5.60.0090.00614.49
5.5.50.0030.01014.48
5.5.40.0090.00614.45
5.5.30.0070.01014.54
5.5.20.0040.01114.29
5.5.10.0000.01514.08
5.5.00.0060.00314.66
5.4.450.0210.03415.40
5.4.440.0080.03315.57
5.4.430.0100.02915.37
5.4.420.0070.03415.54
5.4.410.0070.03015.42
5.4.400.0080.02815.36
5.4.390.0050.03015.37
5.4.380.0040.03415.27
5.4.370.0060.03115.38
5.4.360.0110.02615.29
5.4.350.0070.03215.35
5.4.340.0100.03815.36
5.4.330.0030.01011.50
5.4.320.0050.03115.38
5.4.310.0150.02415.34
5.4.300.0070.03115.38
5.4.290.0090.02915.29
5.4.280.0080.03515.34
5.4.270.0050.03015.33
5.4.260.0070.03015.29
5.4.250.0050.03315.27
5.4.240.0070.03515.34
5.4.230.0070.03115.25
5.4.220.0070.03215.35
5.4.210.0070.03015.29
5.4.200.0080.02814.12
5.4.190.0100.02815.27
5.4.180.0080.03215.29
5.4.170.0120.02615.35
5.4.160.0070.03015.28
5.4.150.0080.02915.31
5.4.140.0070.03813.91
5.4.130.0070.03513.88
5.4.120.0080.03214.07
5.4.110.0050.03914.06
5.4.100.0050.03513.99
5.4.90.0140.03313.96
5.4.80.0100.02713.96
5.4.70.0090.03014.01
5.4.60.0120.02313.86
5.4.50.0050.03013.89
5.4.40.0100.02613.95
5.4.30.0070.02913.96
5.4.20.0150.02514.05
5.4.10.0120.02613.97
5.4.00.0050.04013.79
5.3.290.0100.05314.57
5.3.280.0200.04714.55
5.3.270.0130.05714.75
5.3.260.0130.05314.61
5.3.250.0030.05714.76
5.3.240.0070.06314.66
5.3.230.0030.06014.51
5.3.220.0100.05014.58
5.3.210.0200.04714.47
5.3.200.0200.04014.64
5.3.190.0130.05314.62
5.3.180.0030.06314.49
5.3.170.0000.05714.62
5.3.160.0130.04714.52
5.3.150.0130.05714.47
5.3.140.0130.06714.72
5.3.130.0270.05714.71
5.3.120.0030.07014.46
5.3.110.0170.05014.55
5.3.100.0170.04313.94
5.3.90.0100.05014.18
5.3.80.0100.06713.91
5.3.70.0100.05314.09
5.3.60.0030.05714.16
5.3.50.0070.05313.88
5.3.40.0200.05714.09
5.3.30.0170.04713.91
5.3.20.0100.05013.75
5.3.10.0030.05713.64
5.3.00.0000.05713.80
5.2.170.0030.05311.31
5.2.160.0100.03711.12
5.2.150.0100.04011.07
5.2.140.0100.03711.09
5.2.130.0200.02711.06
5.2.120.0030.04010.96
5.2.110.0030.04311.16
5.2.100.0070.04011.05
5.2.90.0030.04711.03
5.2.80.0130.05011.21
5.2.70.0070.04011.21
5.2.60.0070.04710.98
5.2.50.0100.04011.00
5.2.40.0130.03310.90
5.2.30.0130.04010.89
5.2.20.0030.04310.92
5.2.10.0070.04010.81
5.2.00.0030.04310.74
5.1.60.0130.0239.93
5.1.50.0070.0379.91
5.1.40.0030.03710.12
5.1.30.0000.04310.41
5.1.20.0070.04010.33
5.1.10.0100.03310.00
5.1.00.0070.03710.16
5.0.50.0030.0308.63
5.0.40.0030.0278.45
5.0.30.0000.0478.21
5.0.20.0030.0278.20
5.0.10.0030.0378.28
5.0.00.0030.0438.31
4.4.90.0030.0205.86
4.4.80.0000.0235.87
4.4.70.0000.0275.73
4.4.60.0000.0235.74
4.4.50.0070.0235.80
4.4.40.0000.0405.87
4.4.30.0000.0235.77
4.4.20.0000.0275.95
4.4.10.0000.0235.83
4.4.00.0030.0335.79
4.3.110.0000.0235.71
4.3.100.0000.0235.86
4.3.90.0030.0205.81
4.3.80.0030.0335.65
4.3.70.0070.0175.65
4.3.60.0000.0235.76
4.3.50.0000.0235.64
4.3.40.0070.0305.70
4.3.30.0070.0204.56
4.3.20.0000.0234.42
4.3.10.0000.0234.45
4.3.00.0000.0236.38