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 "Baz", // userland class extending 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); } } class Baz extends ArrayObject {} 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.40.0160.00318.79
8.3.30.0070.01419.25
8.3.20.0110.00720.22
8.3.10.0040.00423.66
8.3.00.0170.00719.33
8.2.170.0150.00022.96
8.2.160.0100.01020.46
8.2.150.0190.00024.18
8.2.140.0070.01124.66
8.2.130.0080.00026.16
8.2.120.0030.00622.30
8.2.110.0030.00619.13
8.2.100.0090.00317.84
8.2.90.0040.00419.09
8.2.80.0000.00917.97
8.2.70.0000.00917.63
8.2.60.0000.00817.93
8.2.50.0070.00618.07
8.2.40.0030.00619.95
8.2.30.0000.00718.26
8.2.20.0030.00617.81
8.2.10.0080.00018.13
8.2.00.0150.00017.73
8.1.270.0130.00723.87
8.1.260.0110.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00622.20
8.1.230.0040.00718.89
8.1.220.0040.00417.74
8.1.210.0030.00518.77
8.1.200.0030.00617.38
8.1.190.0000.00817.35
8.1.180.0000.00919.14
8.1.170.0000.00818.50
8.1.160.0040.00421.95
8.1.150.0000.00818.54
8.1.140.0040.00417.45
8.1.130.0030.00317.73
8.1.120.0040.00417.46
8.1.110.0080.00017.48
8.1.100.0050.00217.36
8.1.90.0040.00417.54
8.1.80.0080.00017.38
8.1.70.0000.00817.43
8.1.60.0040.00417.50
8.1.50.0030.00517.39
8.1.40.0030.00517.51
8.1.30.0080.00017.57
8.1.20.0000.00717.70
8.1.10.0030.00617.54
8.1.00.0080.00017.39
8.0.300.0000.00718.77
8.0.290.0000.00716.75
8.0.280.0000.00818.40
8.0.270.0000.00817.34
8.0.260.0070.00017.29
8.0.250.0030.00316.91
8.0.240.0050.00317.07
8.0.230.0040.00417.06
8.0.220.0030.00317.01
8.0.210.0050.00316.96
8.0.200.0080.00017.11
8.0.190.0000.00717.05
8.0.180.0000.00817.05
8.0.170.0000.00816.93
8.0.160.0040.00416.93
8.0.150.0000.00716.86
8.0.140.0040.00416.98
8.0.130.0030.00313.42
8.0.120.0000.00817.00
8.0.110.0040.00416.98
8.0.100.0040.00416.83
8.0.90.0040.00416.85
8.0.80.0070.01017.00
8.0.70.0070.00016.94
8.0.60.0000.00716.81
8.0.50.0030.00516.85
8.0.30.0090.01217.12
8.0.20.0110.00817.40
8.0.10.0030.00517.04
8.0.00.0100.00816.89
7.4.330.0000.00615.00
7.4.320.0060.00316.63
7.4.300.0030.00316.51
7.4.290.0050.00316.52
7.4.280.0030.00316.59
7.4.270.0000.00716.62
7.4.260.0030.00616.44
7.4.250.0050.00316.40
7.4.240.0020.00516.55
7.4.230.0030.00316.70
7.4.220.0070.01116.67
7.4.210.0060.01216.58
7.4.200.0000.00716.51
7.4.190.0000.00716.57
7.4.160.0080.00816.61
7.4.150.0170.00617.40
7.4.140.0150.01017.86
7.4.130.0080.00916.59
7.4.120.0100.00716.52
7.4.110.0130.00416.54
7.4.100.0000.01816.65
7.4.90.0170.00316.41
7.4.80.0100.01019.39
7.4.70.0090.00916.51
7.4.60.0120.00616.41
7.4.50.0080.00016.59
7.4.40.0060.01316.55
7.4.30.0100.00716.46
7.4.00.0060.01215.11
7.3.330.0000.00513.30
7.3.320.0000.00613.41
7.3.310.0050.00216.36
7.3.300.0050.00216.49
7.3.290.0000.01616.46
7.3.280.0150.00716.47
7.3.270.0040.01217.40
7.3.260.0140.00316.49
7.3.250.0120.00716.65
7.3.240.0130.00416.64
7.3.230.0080.00816.62
7.3.210.0100.00716.51
7.3.200.0150.00619.39
7.3.190.0110.00716.70
7.3.180.0140.00316.52
7.3.170.0100.00616.60
7.3.160.0030.01916.75
7.3.120.0040.01115.11
7.3.00.0060.00616.78
7.2.330.0140.00616.96
7.2.320.0110.00916.75
7.2.310.0130.01316.61
7.2.300.0040.01316.58
7.2.290.0160.00316.60
7.2.130.0070.00716.79
7.2.120.0070.00316.58
7.2.110.0100.00717.00
7.2.100.0040.01116.93
7.2.90.0060.00816.96
7.2.80.0110.00716.69
7.2.70.0090.00016.92
7.2.60.0070.00216.77
7.2.50.0030.01216.77
7.2.40.0090.00316.86
7.2.30.0090.00617.05
7.2.20.0000.01116.72
7.2.10.0070.00416.96
7.2.00.0060.00317.05
7.1.250.0150.00315.73
7.1.240.0000.00815.76
7.1.230.0100.00315.77
7.1.220.0030.01215.88
7.1.210.0030.00615.71
7.1.200.0030.00915.79
7.1.190.0030.00915.82
7.1.180.0030.01015.85
7.1.170.0120.00015.69
7.1.160.0040.00815.54
7.1.150.0030.00715.68
7.1.140.0090.00615.70
7.1.130.0030.00615.79
7.1.120.0030.01015.92
7.1.110.0040.00715.54
7.1.100.0040.00815.64
7.1.90.0040.00715.56
7.1.80.0080.00815.72
7.1.70.0080.00316.38
7.1.60.0070.01017.56
7.1.50.0070.00916.44
7.1.40.0070.00715.79
7.1.30.0030.00615.86
7.1.20.0130.00315.89
7.1.10.0000.01215.74
7.1.00.0020.04519.12
7.0.330.0070.00715.18
7.0.320.0040.00415.46
7.0.310.0130.00015.38
7.0.300.0030.01215.43
7.0.290.0030.00815.27
7.0.280.0130.00015.34
7.0.270.0070.00715.40
7.0.260.0100.00315.30
7.0.250.0000.01315.43
7.0.240.0030.01015.34
7.0.230.0070.00715.37
7.0.220.0000.01615.52
7.0.210.0030.00615.33
7.0.200.0020.00915.92
7.0.190.0130.00315.38
7.0.180.0000.01515.45
7.0.170.0040.00815.38
7.0.160.0040.00815.29
7.0.150.0160.00315.44
7.0.140.0030.04018.68
7.0.130.0070.00715.36
7.0.120.0100.00715.09
7.0.110.0000.00915.47
7.0.100.0090.00615.17
7.0.90.0080.00415.61
7.0.80.0000.01115.27
7.0.70.0040.00715.48
7.0.60.0080.04317.55
7.0.50.0120.04216.66
7.0.40.0040.04016.78
7.0.30.0180.03716.65
7.0.20.0130.04516.83
7.0.10.0020.03716.77
7.0.00.0080.03316.69
5.6.380.0030.01014.44
5.6.370.0070.00314.41
5.6.360.0030.00714.34
5.6.350.0060.00614.58
5.6.340.0030.00614.25
5.6.330.0090.00014.16
5.6.320.0070.01014.30
5.6.310.0000.01214.39
5.6.300.0060.00614.09
5.6.290.0040.00814.30
5.6.280.0030.04117.83
5.6.270.0040.00814.44
5.6.260.0000.00914.13
5.6.250.0040.00714.43
5.6.240.0070.00414.41
5.6.230.0000.00914.25
5.6.220.0100.00014.48
5.6.210.0020.02517.42
5.6.200.0050.04816.21
5.6.190.0100.03517.34
5.6.180.0100.04217.41
5.6.170.0190.03917.32
5.6.160.0050.03317.36
5.6.150.0040.02316.38
5.6.140.0020.03716.31
5.6.130.0070.03416.27
5.6.120.0060.03717.66
5.6.110.0060.04417.57
5.6.100.0000.04717.62
5.6.90.0050.02317.74
5.6.80.0050.02017.22
5.6.70.0080.00414.37
5.6.60.0030.00614.52
5.6.50.0000.01314.04
5.6.40.0030.00914.12
5.6.30.0060.00614.10
5.6.20.0070.00713.89
5.6.10.0070.00414.39
5.6.00.0070.00714.43
5.5.380.0000.00811.18
5.5.370.0030.00611.40
5.5.360.0040.00411.18
5.5.350.2180.02115.77
5.5.340.0030.03614.59
5.5.330.0030.02815.66
5.5.320.0110.02415.78
5.5.310.0180.04215.69
5.5.300.0090.04014.63
5.5.290.0050.04414.65
5.5.280.0090.04215.99
5.5.270.0060.04816.12
5.5.260.0090.03716.03
5.5.250.0050.04215.94
5.5.240.0080.03615.66
5.5.230.0070.00311.18
5.5.220.0050.00511.18
5.5.210.0040.00811.18
5.5.200.0030.00311.18
5.5.190.0020.00511.30
5.5.180.0050.00311.18
5.5.170.0030.00611.18
5.5.160.0000.01011.18
5.5.150.0030.00611.19
5.5.140.0030.00311.18
5.5.130.0030.00311.18
5.5.120.0030.00811.18
5.5.110.0030.00711.18
5.5.100.0000.00711.18
5.5.90.0060.00311.18
5.5.80.0000.00911.18
5.5.70.0000.00711.18
5.5.60.0000.00811.23
5.5.50.0070.00311.18
5.5.40.0110.00411.18
5.5.30.0040.00811.18
5.5.20.0020.00511.18
5.5.10.0030.00911.18
5.5.00.0000.00811.18
5.4.450.0430.03015.39
5.4.440.0420.03515.38
5.4.430.0540.02515.33
5.4.420.0410.02715.38
5.4.410.0020.03415.31
5.4.400.0450.02715.16
5.4.390.0080.03515.00
5.4.380.0180.03214.98
5.4.370.0190.02514.96
5.4.360.0120.03414.85
5.4.350.0380.03614.82
5.4.340.0170.03015.01
5.4.330.0060.00311.18
5.4.320.0060.02011.85
5.4.310.0060.02311.85
5.4.300.0070.01911.85
5.4.290.0070.03811.85
5.4.280.0090.03411.80
5.4.270.0110.03011.80
5.4.260.0120.03111.80
5.4.250.0070.03711.80
5.4.240.0100.03511.80
5.4.230.0040.03811.80
5.4.220.0100.03411.79
5.4.210.0070.03211.79
5.4.200.0120.03111.79
5.4.190.0070.03311.79
5.4.180.0060.03211.79
5.4.170.0100.03111.80
5.4.160.0130.02711.79
5.4.150.0120.02711.79
5.4.140.0070.02911.63
5.4.130.0080.02111.63
5.4.120.0080.02611.61
5.4.110.0050.03311.61
5.4.100.0080.02711.60
5.4.90.0100.03111.61
5.4.80.0080.03111.61
5.4.70.0080.02911.60
5.4.60.0090.03811.60
5.4.50.0090.03011.61
5.4.40.0080.02811.60
5.4.30.0060.02811.60
5.4.20.0110.02311.60
5.4.10.0100.02511.60
5.4.00.0060.02811.34
5.3.290.0070.02111.99
5.3.280.0040.02411.94
5.3.270.0050.02711.95
5.3.260.0100.02411.95
5.3.250.0070.02511.95
5.3.240.0070.02711.95
5.3.230.0050.02611.94
5.3.220.0080.02211.93
5.3.210.0070.02411.93
5.3.200.0020.02611.93
5.3.190.0070.03811.93
5.3.180.0080.04611.93
5.3.170.0050.02711.92
5.3.160.0130.03911.92
5.3.150.0100.03111.93
5.3.140.0060.03011.92
5.3.130.0050.03211.92
5.3.120.0060.04111.92
5.3.110.0070.03011.92
5.3.100.0060.02911.66
5.3.90.0080.03111.65
5.3.80.0070.03011.64
5.3.70.0070.04611.64
5.3.60.0100.03711.63
5.3.50.0060.02911.61
5.3.40.0100.04711.61
5.3.30.0080.04311.59
5.3.20.0050.02711.48
5.3.10.0050.02411.46
5.3.00.0040.02711.45
5.2.170.0050.02410.21
5.2.160.0020.02310.21
5.2.150.0050.02510.21
5.2.140.0030.01910.21
5.2.130.0040.02210.19
5.2.120.0050.02210.19
5.2.110.0110.02510.19
5.2.100.0110.02410.19
5.2.90.0050.02310.19
5.2.80.0040.02010.19
5.2.70.0040.01910.19
5.2.60.0050.02710.16
5.2.50.0170.03010.15
5.2.40.0070.02310.14
5.2.30.0050.01910.12
5.2.20.0030.01810.12
5.2.10.0070.02610.07
5.2.00.0090.03310.00
5.1.60.0060.0229.64
5.1.50.0040.0189.64
5.1.40.0050.0179.63
5.1.30.0040.0209.80
5.1.20.0040.0169.81
5.1.10.0050.0149.68
5.1.00.0040.0199.68
5.0.50.0040.0138.92
5.0.40.0040.0348.85
5.0.30.0060.0308.75
5.0.20.0040.0138.73
5.0.10.0040.0158.72
5.0.00.0020.0188.72
4.4.90.0050.0077.98
4.4.80.0020.0107.97
4.4.70.0040.0107.96
4.4.60.0040.0167.96
4.4.50.0020.0137.97
4.4.40.0020.0247.94
4.4.30.0050.0127.97
4.4.20.0040.0258.01
4.4.10.0100.0288.01
4.4.00.0050.0237.97
4.3.110.0030.0147.92
4.3.100.0060.0177.92
4.3.90.0090.0207.91
4.3.80.0040.0297.88
4.3.70.0040.0217.90
4.3.60.0030.0127.90
4.3.50.0020.0177.90
4.3.40.0030.0197.86
4.3.30.0010.0157.24
4.3.20.0010.0157.23
4.3.10.0040.0197.21
4.3.00.0050.01310.09

preferences:
43.01 ms | 400 KiB | 5 Q