3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Hoge { private $_name; private $_var; private $_default = "class default"; private function __construct($name) { $this->_name = $name; $this->_var = "set by constructor"; printf("Side effect %s\n", get_class($this)); } } function newInstanceWithoutConstructor($class) { $dummy = "stdClass"; $dried = serialize(new $dummy); $fresh = unserialize(str_replace( strlen($dummy) . ':"' . $dummy . '"', strlen($class) . ':"' . $class . '"', $dried )); return $fresh; } function callPrivateConstructor($obj, $args) { $ref = new ReflectionClass($obj); $m = $ref->getConstructor(); $m->setAccessible(true); $m->invokeArgs($obj, $args); } $a = newInstanceWithoutConstructor("Hoge"); //assert(is_a($a, "Hoge")); var_dump($a); callPrivateConstructor($a, array("foo")); var_dump($a);

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.0070.01018.41
8.3.50.0100.00821.14
8.3.40.0120.00918.79
8.3.30.0070.00720.34
8.3.20.0000.00720.51
8.3.10.0090.00020.96
8.3.00.0050.00322.58
8.2.180.0120.00616.60
8.2.170.0070.00722.96
8.2.160.0070.00722.12
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0000.00820.71
8.2.110.0030.00619.27
8.2.100.0040.00717.78
8.2.90.0030.00519.23
8.2.80.0000.00818.04
8.2.70.0040.00417.38
8.2.60.0040.00417.92
8.2.50.0050.00318.07
8.2.40.0080.00018.17
8.2.30.0040.00419.51
8.2.20.0000.00717.61
8.2.10.0030.00617.61
8.2.00.0000.00717.62
8.1.280.0070.01425.92
8.1.270.0060.00323.99
8.1.260.0000.00926.35
8.1.250.0080.00028.09
8.1.240.0000.01320.69
8.1.230.0040.00721.03
8.1.220.0000.00818.77
8.1.210.0030.00519.03
8.1.200.0030.00717.25
8.1.190.0000.00917.43
8.1.180.0000.00818.10
8.1.170.0000.00818.56
8.1.160.0080.00019.01
8.1.150.0040.00418.64
8.1.140.0050.00317.37
8.1.130.0070.00017.84
8.1.120.0000.00817.54
8.1.110.0070.00417.47
8.1.100.0050.00317.51
8.1.90.0040.00317.39
8.1.80.0000.00717.38
8.1.70.0040.00417.38
8.1.60.0000.00917.57
8.1.50.0000.00717.46
8.1.40.0000.00817.51
8.1.30.0000.00817.69
8.1.20.0040.00417.58
8.1.10.0050.00217.59
8.1.00.0040.00417.48
8.0.300.0030.00720.03
8.0.290.0000.00817.05
8.0.280.0040.00418.59
8.0.270.0080.00016.89
8.0.260.0060.00316.91
8.0.250.0070.00017.05
8.0.240.0070.00317.00
8.0.230.0070.00017.03
8.0.220.0030.00516.81
8.0.210.0040.00416.94
8.0.200.0030.00317.07
8.0.190.0040.00416.94
8.0.180.0000.00816.89
8.0.170.0030.00516.86
8.0.160.0020.00516.96
8.0.150.0040.00416.92
8.0.140.0000.01116.82
8.0.130.0000.00613.35
8.0.120.0040.00416.95
8.0.110.0070.00016.93
8.0.100.0040.00416.99
8.0.90.0040.00416.77
8.0.80.0100.00617.01
8.0.70.0040.00417.01
8.0.60.0000.00717.09
8.0.50.0000.00716.92
8.0.30.0070.01116.92
8.0.20.0100.00917.40
8.0.10.0030.00516.81
8.0.00.0100.00916.96
7.4.330.0030.00316.77
7.4.320.0030.00316.52
7.4.300.0000.00716.61
7.4.290.0030.00316.57
7.4.280.0030.00316.56
7.4.270.0000.00716.61
7.4.260.0030.00313.32
7.4.250.0020.00516.38
7.4.240.0040.00416.58
7.4.230.0000.00816.45
7.4.220.0130.01916.68
7.4.210.0070.01016.55
7.4.200.0030.00516.38
7.4.190.0030.00316.68
7.4.160.0090.00616.51
7.4.150.0030.01417.40
7.4.140.0120.01417.86
7.4.130.0080.00816.61
7.4.120.0090.00716.48
7.4.110.0190.00616.57
7.4.100.0120.00616.58
7.4.90.0030.01416.74
7.4.80.0180.00319.39
7.4.70.0110.00516.55
7.4.60.0130.02616.55
7.4.50.0060.00316.40
7.4.40.0070.00422.77
7.4.30.0080.00816.51
7.4.00.0060.01115.09
7.3.330.0030.00313.45
7.3.320.0000.00513.34
7.3.310.0000.00716.25
7.3.300.0000.00716.40
7.3.290.0110.00416.38
7.3.280.0130.00716.39
7.3.270.0120.00617.40
7.3.260.0050.02018.24
7.3.250.0130.00616.47
7.3.240.0140.00316.67
7.3.230.0120.00416.43
7.3.210.0150.00316.56
7.3.200.0120.00919.39
7.3.190.0090.01216.35
7.3.180.0180.00616.45
7.3.170.0160.00016.45
7.3.160.0110.01116.64
7.3.120.0000.01614.90
7.2.330.0100.00716.76
7.2.320.0100.00716.68
7.2.310.0130.01016.84
7.2.300.0040.01216.71
7.2.290.0100.00716.61
7.2.00.0040.01219.39
7.1.100.0060.00617.99
7.1.70.0070.00017.04
7.1.60.0030.01019.17
7.1.50.0070.01017.11
7.1.00.0000.06722.36
7.0.200.0030.00614.76
7.0.140.0000.07721.95
7.0.60.0130.08020.09
7.0.50.0030.08317.91
7.0.40.0070.04020.04
7.0.30.0700.07720.19
7.0.20.0170.05020.34
7.0.10.0070.05020.07
7.0.00.0030.04320.31
5.6.280.0100.06721.13
5.6.210.0030.08020.47
5.6.200.0100.07318.20
5.6.190.0070.04020.58
5.6.180.3600.04720.55
5.6.170.0270.05720.56
5.6.160.0170.07320.50
5.6.150.0030.06318.18
5.6.140.0030.03718.17
5.6.130.0030.08318.20
5.6.120.0070.04321.00
5.6.110.0030.04020.99
5.6.100.0100.05320.96
5.6.90.0170.07321.09
5.6.80.0070.07320.37
5.6.70.4370.04320.54
5.5.350.0330.07020.35
5.5.340.0000.05318.05
5.5.330.0030.04720.19
5.5.320.0170.05020.35
5.5.310.0400.07320.24
5.5.300.0100.07018.06
5.5.290.0200.05317.93
5.5.280.0070.08720.98
5.5.270.0030.08720.96
5.5.260.0070.08320.80
5.5.250.0100.07020.48
5.5.240.0100.04720.27
5.4.450.0000.04319.46
5.4.440.0030.05719.16
5.4.430.0000.04019.54
5.4.420.0000.05019.58
5.4.410.0000.05019.18
5.4.400.0030.06018.86
5.4.390.0000.08318.88
5.4.380.0030.06719.04
5.4.370.0030.03719.16
5.4.360.0070.03319.15
5.4.350.0000.05019.06
5.4.340.0030.06319.16
5.4.320.0030.07719.32
5.4.310.0030.08018.99
5.4.300.0170.03719.21
5.4.290.0000.07719.14
5.4.280.0270.05719.13
5.4.270.0070.05019.24
5.4.260.0100.06719.10
5.4.250.0000.04318.99
5.4.240.0070.06019.10
5.4.230.0100.06318.97
5.4.220.0030.07718.97
5.4.210.0100.06019.23
5.4.200.0030.04719.23
5.4.190.0030.05019.14
5.4.180.0000.04019.00
5.4.170.0000.04019.08
5.4.160.0030.08019.18
5.4.150.0030.05319.14
5.4.140.0000.06316.45
5.4.130.0130.03316.40
5.4.120.0230.03316.71
5.4.110.0000.06716.26
5.4.100.0000.06716.61
5.4.90.0030.06316.56
5.4.80.0030.06016.57
5.4.70.0000.07716.23
5.4.60.0030.07016.38
5.4.50.0000.07316.16
5.4.40.0000.07316.43
5.4.30.0000.05016.34
5.4.20.0030.04016.26
5.4.10.0070.04716.51
5.4.00.0170.04715.73
5.3.290.0070.07314.60
5.3.280.0030.05014.63
5.3.270.0030.05014.53
5.3.260.0030.07314.61
5.3.250.0030.04314.73
5.3.240.0070.04714.59
5.3.230.0070.05314.69
5.3.220.0000.07714.58
5.3.210.0000.08314.60
5.3.200.0030.04314.55
5.3.190.0070.06714.66
5.3.180.0070.06714.64
5.3.170.0030.07014.57
5.3.160.0070.07714.60
5.3.150.0030.05314.50
5.3.140.0070.03714.68
5.3.130.0000.07314.59
5.3.120.0070.07714.50
5.3.110.0100.07014.57
5.3.100.0030.07314.14
5.3.90.0070.06313.95
5.3.80.0000.08014.04
5.3.70.0000.04313.96
5.3.60.0030.04314.11
5.3.50.0000.07313.89
5.3.40.0000.04013.88
5.3.30.0130.02313.82
5.3.20.0000.03313.71
5.3.10.0030.03713.89
5.3.00.0030.03313.57
5.2.170.0030.05012.44
5.2.160.0170.02012.44
5.2.150.0030.03012.44
5.2.140.0000.03012.44
5.2.130.0000.03012.44
5.2.120.0000.03012.44
5.2.110.0000.03012.44
5.2.100.0030.03012.44
5.2.90.0000.03012.44
5.2.80.0000.03712.44
5.2.70.0000.03012.44
5.2.60.0070.02312.44
5.2.50.0000.03012.44
5.2.40.0070.02312.44
5.2.30.0070.02312.44
5.2.20.0000.03012.44
5.2.10.0000.03012.44
5.2.00.0030.02312.44
5.1.60.0000.02312.44
5.1.50.0030.02012.44
5.1.40.0000.02312.44
5.1.30.0030.02312.44
5.1.20.0000.04012.44
5.1.10.0000.02312.44
5.1.00.0000.02312.44
5.0.50.0000.02312.44
5.0.40.0000.02012.44
5.0.30.0000.03012.44
5.0.20.0000.02012.44
5.0.10.0030.01712.44
5.0.00.0000.03012.44
4.4.90.0000.01312.44
4.4.80.0000.01312.44
4.4.70.0000.01312.44
4.4.60.0000.01712.44
4.4.50.0000.01312.44
4.4.40.0000.02312.44
4.4.30.0000.01712.44
4.4.20.0000.01712.44
4.4.10.0000.01712.44
4.4.00.0000.03012.44
4.3.110.0000.01712.44
4.3.100.0000.01312.44
4.3.90.0000.01312.44
4.3.80.0000.02312.44
4.3.70.0000.01312.44
4.3.60.0000.01312.44
4.3.50.0000.01712.44
4.3.40.0030.02012.44
4.3.30.0000.01312.44
4.3.20.0000.01712.44
4.3.10.0030.01012.44
4.3.00.0000.01312.44

preferences:
56.19 ms | 401 KiB | 5 Q