3v4l.org

run code in 300+ PHP versions simultaneously
<?php // ----------------------------------- script1.php -------------- $provider = function() { $instance = new PDO('mysql:......;charset=utf8', 'username', 'password'); $instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $instance->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); return $instance; }; $factory = new StructureFactory( $provider ); $something = $factory->create('Something'); $foobar = $factory->create('Foobar'); // ----------------------------------- script2.php -------------- class StructureFactory { protected $provider = null; protected $connection = null; public function __construct( callable $provider ) { $this->provider = $provider; } public function create( $name) { if ( $this->connection === null ) { $this->connection = call_user_func( $this->provider ); } return new $name( $this->connection ); } }

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.0100.01016.50
8.3.50.0070.00921.22
8.3.40.0070.00718.81
8.3.30.0060.00919.05
8.3.20.0070.00020.16
8.3.10.0050.00321.69
8.3.00.0080.00019.38
8.2.180.0090.00918.48
8.2.170.0120.00319.07
8.2.160.0070.01122.96
8.2.150.0040.00425.66
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0080.00021.00
8.2.110.0070.00319.21
8.2.100.0090.00317.49
8.2.90.0050.00319.08
8.2.80.0040.00417.97
8.2.70.0050.00517.50
8.2.60.0040.00417.80
8.2.50.0080.00018.07
8.2.40.0040.00419.82
8.2.30.0040.00418.09
8.2.20.0000.00717.64
8.2.10.0030.00518.09
8.2.00.0070.00318.08
8.1.280.0210.00025.92
8.1.270.0090.00920.33
8.1.260.0080.00026.35
8.1.250.0030.00528.09
8.1.240.0080.00419.45
8.1.230.0070.00317.82
8.1.220.0040.00417.74
8.1.210.0080.00018.77
8.1.200.0060.00317.25
8.1.190.0040.00417.23
8.1.180.0040.00418.10
8.1.170.0020.00518.57
8.1.160.0000.00721.93
8.1.150.0030.00518.91
8.1.140.0040.00417.43
8.1.130.0030.00317.77
8.1.120.0040.00417.42
8.1.110.0050.00317.56
8.1.100.0000.00717.53
8.1.90.0040.00417.46
8.1.80.0040.00417.38
8.1.70.0030.00317.48
8.1.60.0040.00417.52
8.1.50.0000.00917.53
8.1.40.0000.00917.57
8.1.30.0060.00317.68
8.1.20.0040.00417.60
8.1.10.0000.00717.54
8.1.00.0080.00317.56
8.0.300.0000.00818.77
8.0.290.0040.00416.63
8.0.280.0000.00818.40
8.0.270.0030.00316.77
8.0.260.0030.00317.13
8.0.250.0030.00316.88
8.0.240.0000.00816.95
8.0.230.0030.00616.94
8.0.220.0030.00316.93
8.0.210.0050.00316.83
8.0.200.0030.00316.91
8.0.190.0080.00416.91
8.0.180.0050.00216.91
8.0.170.0000.00817.00
8.0.160.0000.00816.91
8.0.150.0000.00716.88
8.0.140.0000.00716.83
8.0.130.0030.00313.42
8.0.120.0040.00416.93
8.0.110.0040.00416.92
8.0.100.0070.00017.00
8.0.90.0000.00816.88
8.0.80.0060.00916.91
8.0.70.0000.00816.79
8.0.60.0040.00416.78
8.0.50.0000.00816.86
8.0.30.0150.00517.01
8.0.20.0120.01017.40
8.0.10.0040.00417.10
8.0.00.0070.01016.80
7.4.330.0020.00215.04
7.4.320.0000.00616.55
7.4.300.0000.00716.44
7.4.290.0040.00416.65
7.4.280.0030.00516.54
7.4.270.0080.00016.55
7.4.260.0060.00316.52
7.4.250.0050.00216.45
7.4.240.0020.00516.54
7.4.230.0000.00716.70
7.4.220.0060.01316.73
7.4.210.0120.00316.63
7.4.200.0000.00916.65
7.4.160.0140.00716.40
7.4.150.0060.01217.40
7.4.140.0120.00517.86
7.4.130.0140.00516.61
7.4.120.0130.00516.58
7.4.110.0090.00916.43
7.4.100.0040.01316.54
7.4.90.0060.01316.36
7.4.80.0060.01019.39
7.4.70.0080.01116.48
7.4.60.0030.01616.49
7.4.50.0000.00516.35
7.4.40.0130.00616.43
7.4.30.0100.00716.57
7.4.00.0090.00415.03
7.3.330.0000.00613.45
7.3.320.0060.00013.33
7.3.310.0030.00316.48
7.3.300.0070.00016.39
7.3.290.0060.01116.38
7.3.280.0080.01016.33
7.3.270.0120.01217.40
7.3.260.0060.01116.34
7.3.250.0120.00616.44
7.3.240.0140.00316.54
7.3.230.0170.00016.42
7.3.210.0040.01316.34
7.3.200.0180.00919.39
7.3.190.0100.00716.32
7.3.180.0040.01116.30
7.3.170.0040.01316.45
7.3.160.0130.00316.51
7.3.10.0110.00916.08
7.3.00.0180.00016.28
7.2.330.0120.00616.80
7.2.320.0120.00616.55
7.2.310.0030.01616.75
7.2.300.0120.00616.76
7.2.290.0100.00716.45
7.2.130.0100.01016.60
7.2.120.0170.00316.44
7.2.110.0140.00716.62
7.2.100.0110.01116.61
7.2.90.0110.00716.39
7.2.80.0150.01016.68
7.2.70.0150.00716.63
7.2.60.0080.01016.68
7.2.50.0190.00316.78
7.2.40.0160.00816.69
7.2.30.0080.01116.67
7.2.20.0100.01716.68
7.2.10.0120.00816.56
7.2.00.0080.00918.14
7.1.250.0080.00715.34
7.1.200.0030.00915.65
7.1.100.0090.00618.09
7.1.70.0120.00017.16
7.1.60.0110.01119.59
7.1.50.0040.01517.02
7.1.00.0100.07022.30
7.0.200.0030.00616.53
7.0.60.0170.07319.82
7.0.50.0000.04717.96
7.0.40.0100.08720.23
7.0.30.0370.07020.07
7.0.20.0130.04720.06
7.0.10.0030.04320.30
7.0.00.0030.07020.15
5.6.280.0030.07320.90
5.6.210.0030.09320.73
5.6.200.0030.04018.18
5.6.190.0070.05720.41
5.6.180.0270.05020.39
5.6.170.0300.07720.45
5.6.160.0100.03720.71
5.6.150.0030.08018.15
5.6.140.0170.07018.19
5.6.130.0030.04318.15
5.6.120.0100.04321.02
5.6.110.0200.08021.02
5.6.100.0130.07721.12
5.6.90.0100.07021.09
5.6.80.0070.03720.49
5.6.70.4530.04020.40
5.5.350.0330.07720.51
5.5.340.0030.05317.95
5.5.330.0070.08020.42
5.5.320.0330.05020.25
5.5.310.0270.07320.41
5.5.300.0070.05317.98
5.5.290.0030.04017.95
5.5.280.0070.03720.64
5.5.270.0030.05720.90
5.5.260.0070.06720.87
5.5.250.0030.09020.56
5.5.240.3270.03720.20
5.4.450.2100.04019.17
5.4.440.2130.03319.17
5.4.430.2530.04719.45
5.4.420.2170.03319.54
5.4.410.2170.03019.33
5.4.400.2130.03319.00
5.4.390.2300.03719.22
5.4.380.2030.03318.87
5.4.370.2200.04319.10
5.4.360.2170.03318.84
5.4.350.2300.04319.13
5.4.340.2100.05019.24
5.4.320.2300.03319.00
5.4.310.2300.04019.24
5.4.300.2270.04319.14
5.4.290.2300.03718.84
5.4.280.2230.04319.19
5.4.270.2230.04018.95
5.4.260.2000.04019.09
5.4.250.2470.04019.21
5.4.240.2300.04018.86
5.4.230.2300.04019.13
5.4.220.2300.03719.30
5.4.210.2330.04018.99
5.4.200.2230.04018.98
5.4.190.2070.03719.07
5.4.180.2330.04018.86
5.4.170.2370.03719.07
5.4.160.2130.03019.11
5.4.150.2330.04318.82
5.4.140.2330.04316.58
5.4.130.2070.04016.32
5.4.120.2300.04316.41
5.4.110.2370.03716.60
5.4.100.2300.04016.33
5.4.90.2370.04316.42
5.4.80.2370.04316.39
5.4.70.2330.03316.59
5.4.60.2230.03316.24
5.4.50.2330.03716.52
5.4.40.2000.04016.58
5.4.30.2330.03016.53
5.4.20.2400.04316.42
5.4.10.2300.03716.52
5.4.00.2370.04015.88
5.3.290.2170.03314.79
5.3.280.2100.04014.61
5.3.270.2200.04014.59
5.3.260.2100.03714.59
5.3.250.2230.03014.72
5.3.240.2100.03314.59
5.3.230.2330.03714.68
5.3.220.2100.03714.80
5.3.210.2070.04014.79
5.3.200.2070.04014.58
5.3.190.2100.03714.54
5.3.180.2370.03714.79
5.3.170.2170.03014.57
5.3.160.2200.03714.47
5.3.150.2200.03714.48
5.3.140.2200.03014.46
5.3.130.2130.03314.60
5.3.120.2330.04014.60
5.3.110.2630.04714.45
5.3.100.2370.04014.05
5.3.90.2130.03714.27
5.3.80.2300.03714.11
5.3.70.2270.04313.95
5.3.60.2370.04014.16
5.3.50.2170.03714.18
5.3.40.2470.03714.03
5.3.30.2470.04013.83
5.3.20.2230.04713.85
5.3.10.2470.03713.76
5.3.00.2300.03713.56
5.2.170.1930.03010.98
5.2.160.2000.03311.08
5.2.150.1700.03010.98
5.2.140.2030.03011.15
5.2.130.2100.02710.96
5.2.120.2070.02711.01
5.2.110.1970.03310.95
5.2.100.1830.02310.94
5.2.90.1900.04010.93
5.2.80.1800.02710.96
5.2.70.1870.03311.02
5.2.60.1930.03011.09
5.2.50.1970.03010.85
5.2.40.1370.02710.89
5.2.30.1600.03010.82
5.2.20.1400.02710.80
5.2.10.1330.03010.84
5.2.00.1670.03010.62
5.1.60.0730.0379.93
5.1.50.0000.0439.87
5.1.40.0030.0279.95
5.1.30.0030.03310.30
5.1.20.0030.05310.46
5.1.10.0630.0309.93
5.1.00.1530.02010.23
5.0.50.0830.0208.43
5.0.40.0730.0208.38
5.0.30.0900.0408.12
5.0.20.0900.0178.35
5.0.10.0870.0338.25
5.0.00.0830.0378.10
4.4.90.0800.0207.53
4.4.80.0900.0237.53
4.4.70.0870.0277.53
4.4.60.0900.0277.53
4.4.50.0870.0277.53
4.4.40.0870.0337.53
4.4.30.0700.0177.53
4.4.20.1030.0237.53
4.4.10.0770.0137.53
4.4.00.0700.0277.53
4.3.110.0970.0237.53
4.3.100.0900.0137.53
4.3.90.0930.0207.53
4.3.80.0900.0237.53
4.3.70.0730.0177.53
4.3.60.0770.0107.53
4.3.50.0730.0137.53
4.3.40.0730.0237.53
4.3.30.0330.0177.53
4.3.20.0370.0137.53
4.3.10.0330.0177.53
4.3.00.0330.0177.53

preferences:
38.72 ms | 404 KiB | 6 Q