3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classNames = array( "Foo", // userland class "StdClass", // class defined by php-src, but still not considered as internal "Bar", // userland class implementing Serializable "ReflectionClass", // internal class "ArrayObject", // internal class implementing Serializable ); function instanitateWithoutConstructorThroughUnserialize($className) { return unserialize(sprintf('O:%d:"%s":0:{}', strlen($className), $className)); } function instanitateWithoutConstructorThroughReflection($className) { try { $ref = new ReflectionClass($className); return $ref->newInstanceWithoutConstructor(); } catch (ReflectionException $e) { return $e; } } class Foo {} class Bar implements Serializable { private $data; public function serialize() { return serialize($this->data); } public function unserialize($data) { $this->data = unserialize($data); } } foreach($classNames as $className) { echo "$className\n"; var_dump(instanitateWithoutConstructorThroughUnserialize($className)); if (version_compare(PHP_VERSION, '5.4.0') >= 0) { var_dump(instanitateWithoutConstructorThroughReflection($className)); } echo "\n"; }

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.0160.00316.62
8.3.60.0120.00916.75
8.3.50.0140.00521.97
8.3.40.0120.00318.67
8.3.30.0160.00319.05
8.3.20.0070.01120.34
8.3.10.0150.00423.48
8.3.00.0050.00519.26
8.2.180.0070.00718.55
8.2.170.0080.00822.96
8.2.160.0160.00620.39
8.2.150.0190.00024.18
8.2.140.0090.00924.66
8.2.130.0040.00426.16
8.2.120.0040.00422.13
8.2.110.0030.00721.12
8.2.100.0000.01118.03
8.2.90.0040.00419.28
8.2.80.0030.00517.97
8.2.70.0060.00317.63
8.2.60.0040.00418.04
8.2.50.0000.01318.07
8.2.40.0040.00419.78
8.2.30.0020.00518.29
8.2.20.0100.00017.75
8.2.10.0000.00718.14
8.2.00.0100.00817.66
8.1.280.0120.00625.92
8.1.270.0110.00423.87
8.1.260.0040.00426.35
8.1.250.0030.00728.09
8.1.240.0060.00322.25
8.1.230.0090.00320.84
8.1.220.0050.00317.74
8.1.210.0000.00818.77
8.1.200.0030.00617.23
8.1.190.0030.00517.25
8.1.180.0060.00319.13
8.1.170.0030.00618.58
8.1.160.0000.00722.07
8.1.150.0040.00418.56
8.1.140.0040.00417.49
8.1.130.0040.00417.82
8.1.120.0040.00417.38
8.1.110.0040.00417.46
8.1.100.0000.00817.46
8.1.90.0040.00417.51
8.1.80.0040.00417.39
8.1.70.0040.00417.39
8.1.60.0040.00417.50
8.1.50.0040.00417.50
8.1.40.0050.00317.50
8.1.30.0080.00017.60
8.1.20.0000.00817.66
8.1.10.0000.00717.46
8.1.00.0000.00817.60
8.0.300.0040.00418.77
8.0.290.0070.00016.63
8.0.280.0000.00718.47
8.0.270.0030.00417.28
8.0.260.0060.00017.22
8.0.250.0030.00316.91
8.0.240.0030.00317.09
8.0.230.0000.00817.02
8.0.220.0030.00316.89
8.0.210.0000.00816.89
8.0.200.0000.00716.99
8.0.190.0040.00317.05
8.0.180.0050.00317.01
8.0.170.0000.00817.05
8.0.160.0030.00516.80
8.0.150.0040.00416.83
8.0.140.0000.00716.93
8.0.130.0060.00313.37
8.0.120.0050.00316.95
8.0.110.0000.00817.01
8.0.100.0070.00016.83
8.0.90.0040.00417.05
8.0.80.0060.01017.00
8.0.70.0040.00416.84
8.0.60.0000.00717.03
8.0.50.0000.00716.86
8.0.30.0070.01217.23
8.0.20.0120.00817.40
8.0.10.0050.00316.98
8.0.00.0120.01116.69
7.4.330.0000.00515.00
7.4.320.0000.00816.54
7.4.300.0030.00316.45
7.4.290.0000.00716.67
7.4.280.0070.00016.53
7.4.270.0040.00416.58
7.4.260.0050.00516.63
7.4.250.0000.00716.60
7.4.240.0020.00516.54
7.4.230.0000.00716.46
7.4.220.0100.00716.50
7.4.210.0040.01016.56
7.4.200.0030.00316.42
7.4.190.0080.00016.68
7.4.160.0040.01316.58
7.4.150.0120.00617.40
7.4.140.0120.00717.86
7.4.130.0100.00716.56
7.4.120.0080.00816.48
7.4.110.0140.00716.39
7.4.100.0150.00316.72
7.4.90.0100.00716.52
7.4.80.0160.00519.39
7.4.70.0070.01016.59
7.4.60.0100.00716.44
7.4.50.0030.00616.38
7.4.40.0070.01316.46
7.4.30.0100.00716.60
7.4.00.0070.00714.93
7.3.330.0060.00013.46
7.3.320.0050.00013.53
7.3.310.0040.00416.48
7.3.300.0050.00316.42
7.3.290.0030.01216.51
7.3.280.0090.01116.48
7.3.270.0080.00817.40
7.3.260.0100.01016.39
7.3.250.0100.00716.54
7.3.240.0120.00416.70
7.3.230.0030.01316.42
7.3.210.0090.01216.38
7.3.200.0110.00619.39
7.3.190.0130.01016.35
7.3.180.0040.01416.47
7.3.170.0030.01516.61
7.3.160.0030.01316.52
7.3.120.0120.00614.68
7.3.10.0030.00916.51
7.3.00.0090.00616.69
7.2.330.0150.01216.70
7.2.320.0040.02016.84
7.2.310.0180.00716.73
7.2.300.0140.00316.68
7.2.290.0100.00716.47
7.2.130.0070.00717.06
7.2.120.0040.01116.88
7.2.110.0070.00716.86
7.2.100.0040.01216.69
7.2.90.0000.01717.09
7.2.80.0060.00617.05
7.2.70.0030.01217.00
7.2.60.0060.00816.96
7.2.50.0040.01117.01
7.2.40.0080.00316.97
7.2.30.0090.00616.70
7.2.20.0000.01516.65
7.2.10.0030.00916.96
7.2.00.0000.01216.94
7.1.250.0040.00715.81
7.1.200.0110.00015.58
7.1.70.0000.00817.24
7.1.60.0170.00319.46
7.1.50.0030.01317.05
7.1.00.0030.07722.35
7.0.200.0060.00316.84
7.0.140.0070.06321.97
7.0.60.0100.04019.94
7.0.50.0070.03717.90
7.0.40.0100.05320.05
7.0.30.0130.04720.25
7.0.20.0400.07320.24
7.0.10.0030.04720.10
7.0.00.0030.05020.07
5.6.280.0100.06721.13
5.6.210.0100.08020.56
5.6.200.0100.06018.22
5.6.190.0030.05320.41
5.6.180.0230.03720.47
5.6.170.0230.08020.45
5.6.160.0100.08320.39
5.6.150.0000.08718.16
5.6.140.0070.03718.24
5.6.130.0130.07718.21
5.6.120.0100.05321.02
5.6.110.0100.08721.04
5.6.100.0070.05021.02
5.6.90.0130.07021.05
5.6.80.0030.08320.52
5.5.350.0270.05320.43
5.5.340.0070.04017.98
5.5.330.0070.05320.44
5.5.320.0100.07720.28
5.5.310.0300.04320.27
5.5.300.0070.08318.01
5.5.290.0070.06717.94
5.5.280.0070.05720.86
5.5.270.0030.04320.80
5.5.260.0070.07320.81
5.5.250.0100.08020.70
5.5.240.0000.04320.35
5.4.450.0700.07019.31
5.4.440.0970.07019.61
5.4.430.0870.06719.52
5.4.420.0630.06019.61
5.4.410.0800.06319.03
5.4.400.0870.06019.15
5.4.390.0670.06019.29
5.4.380.0300.05318.73
5.4.370.0200.05718.73
5.4.360.0430.04318.71
5.4.350.0570.03718.75
5.4.340.0270.05318.64
5.4.320.0050.03812.51
5.4.310.0060.03812.51
5.4.300.0080.04012.51
5.4.290.0110.05012.52
5.4.280.0120.04812.41
5.4.270.0240.06612.41
5.4.260.0100.05012.41
5.4.250.0130.06212.41
5.4.240.0160.06212.41
5.4.230.0130.07812.40
5.4.220.0110.05512.40
5.4.210.0130.05212.40
5.4.200.0140.07912.41
5.4.190.0050.07312.40
5.4.180.0100.05912.40
5.4.170.0100.05612.41
5.4.160.0090.05312.40
5.4.150.0160.05312.40
5.4.140.0120.05712.09
5.4.130.0090.05012.07
5.4.120.0120.05212.03
5.4.110.0130.05212.02
5.4.100.0140.05112.02
5.4.90.0120.05012.02
5.4.80.0140.04912.03
5.4.70.0190.05012.02
5.4.60.0160.07912.02
5.4.50.0100.06212.02
5.4.40.0130.05412.01
5.4.30.0160.07812.00
5.4.20.0200.07012.00
5.4.10.0130.05212.00
5.4.00.0130.07011.49
5.3.290.0070.03712.80
5.3.280.0360.11512.71
5.3.270.0500.13412.72
5.3.260.0370.12512.72
5.3.250.0180.07612.72
5.3.240.0190.11712.71
5.3.230.0270.09812.71
5.3.220.0230.07812.68
5.3.210.0140.10012.68
5.3.200.0250.12512.68
5.3.190.0270.10012.68
5.3.180.0100.09712.67
5.3.170.0130.05712.67
5.3.160.0220.08612.68
5.3.150.0170.08012.67
5.3.140.0130.08512.66
5.3.130.0250.12312.66
5.3.120.0190.08112.66
5.3.110.0140.08212.66
5.3.100.0220.09012.13
5.3.90.0180.07112.11
5.3.80.0180.09812.12
5.3.70.0260.09512.09
5.3.60.0090.05512.09
5.3.50.0100.08212.03
5.3.40.0160.07112.04
5.3.30.0090.05512.00
5.3.20.0070.04911.78
5.3.10.0070.04811.74
5.3.00.0070.04911.73
5.2.170.0200.0549.23
5.2.160.0120.0879.23
5.2.150.0090.0469.23
5.2.140.0130.0669.23
5.2.130.0190.0759.19
5.2.120.0050.0339.19
5.2.110.0050.0389.19
5.2.100.0110.0299.19
5.2.90.0050.0509.19
5.2.80.0150.0559.19
5.2.70.0200.0659.19
5.2.60.0270.0779.14
5.2.50.0100.0829.11
5.2.40.0210.0739.09
5.2.30.0070.0439.06
5.2.20.0060.0519.05
5.2.10.0080.0358.96
5.2.00.0040.0468.82
5.1.60.0130.0428.10
5.1.50.0290.0658.10
5.1.40.0220.0818.08
5.1.30.0140.0538.43
5.1.20.0140.0708.45
5.1.10.0090.0438.18
5.1.00.0100.0468.18
5.0.50.0180.0266.65
5.0.40.0090.0866.52
5.0.30.0100.1056.33
5.0.20.0060.0356.30
5.0.10.0090.0656.27
5.0.00.0110.0746.27
4.4.90.0120.0374.77
4.4.80.0060.0264.75
4.4.70.0040.0274.75
4.4.60.0090.0184.76
4.4.50.0060.0194.77
4.4.40.0090.0574.71
4.4.30.0050.0384.76
4.4.20.0040.0414.84
4.4.10.0120.0434.85
4.4.00.0100.0874.76
4.3.110.0080.0344.67
4.3.100.0110.0464.66
4.3.90.0060.0434.64
4.3.80.0100.0324.58
4.3.70.0010.0194.63
4.3.60.0040.0154.62
4.3.50.0010.0184.62
4.3.40.0030.0254.54
4.3.30.0030.0163.30
4.3.20.0030.0173.28
4.3.10.0020.0173.24
4.3.00.0170.0239.06

preferences:
55.99 ms | 401 KiB | 5 Q