3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface DepInterface {} class Dependency implements DepInterface { public function __construct($param1, $param2) {} } class NotDI { protected $dep; public function __construct() { // 1. if we ever change the constructor of the Dependency class we now need to // go fiddle with the implementation in every class ever. // 2. not only that, now this class needs to know the proper configuration for // its dependency, which is not necessarily something it need be responsible for // 3. we now have a hard dependency on this one, concrete implementation. $this->dep = new Dependency('foo', 'bar'); } } class IsDI { protected $dep; public function __construct(DepInterface $dep) { // Now we no longer need care how the object is instantiated, or what it even is // so long as it implements the interface that we are expecting. $this->dep = $dep; } } $dep = new Dependency('foo', 'bar'); $johnny = new IsDI($dep);

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.0090.00918.30
8.3.50.0070.00717.97
8.3.40.0090.00918.68
8.3.30.0090.00618.65
8.3.20.0040.00420.81
8.3.10.0040.00423.51
8.3.00.0080.00023.57
8.2.180.0090.00618.13
8.2.170.0110.00422.96
8.2.160.0060.00922.08
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0050.00319.67
8.2.110.0000.01022.26
8.2.100.0070.00417.72
8.2.90.0000.00717.84
8.2.80.0000.00917.97
8.2.70.0000.00917.93
8.2.60.0080.00017.91
8.2.50.0040.00418.10
8.2.40.0040.00419.35
8.2.30.0040.00419.20
8.2.20.0000.00918.13
8.2.10.0050.00219.21
8.2.00.0000.00719.27
8.1.280.0040.01125.92
8.1.270.0030.00618.77
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0070.01023.91
8.1.230.0080.00324.02
8.1.220.0080.00017.74
8.1.210.0050.00318.97
8.1.200.0070.00317.36
8.1.190.0040.00417.22
8.1.180.0080.00418.10
8.1.170.0050.00318.65
8.1.160.0000.00718.89
8.1.150.0000.00718.92
8.1.140.0050.00322.20
8.1.130.0040.00420.10
8.1.120.0050.00317.48
8.1.110.0080.00017.45
8.1.100.0000.00717.38
8.1.90.0030.00517.46
8.1.80.0040.00417.45
8.1.70.0030.00617.44
8.1.60.0090.00017.56
8.1.50.0040.00417.50
8.1.40.0030.00617.47
8.1.30.0000.00817.64
8.1.20.0030.00617.64
8.1.10.0050.00217.38
8.1.00.0000.00717.33
8.0.300.0000.00819.90
8.0.290.0050.00316.75
8.0.280.0040.00418.32
8.0.270.0070.00017.25
8.0.260.0000.00618.30
8.0.250.0050.00216.92
8.0.240.0000.00716.97
8.0.230.0030.00316.91
8.0.220.0060.00016.96
8.0.210.0040.00416.91
8.0.200.0030.00316.94
8.0.190.0070.00017.02
8.0.180.0030.00616.93
8.0.170.0040.00416.95
8.0.160.0040.00416.99
8.0.150.0040.00316.78
8.0.140.0040.00416.91
8.0.130.0060.00013.39
8.0.120.0060.00317.00
8.0.110.0000.00816.95
8.0.100.0000.00816.96
8.0.90.0050.00216.85
8.0.80.0120.00916.82
8.0.70.0060.00316.83
8.0.60.0040.00417.00
8.0.50.0030.00516.94
8.0.30.0100.01017.10
8.0.20.0150.00417.40
8.0.10.0040.00417.19
8.0.00.0140.01016.66
7.4.330.0000.00516.79
7.4.320.0000.00616.50
7.4.300.0000.00716.51
7.4.290.0030.00316.64
7.4.280.0050.00216.59
7.4.270.0000.00816.52
7.4.260.0000.00716.45
7.4.250.0000.00816.46
7.4.240.0030.00316.65
7.4.230.0070.00316.67
7.4.220.0030.00516.58
7.4.210.0080.00916.57
7.4.200.0030.00316.50
7.4.160.0060.01216.42
7.4.140.0090.01017.86
7.4.130.0180.00616.47
7.4.120.0030.01416.50
7.4.110.0080.01616.49
7.4.100.0160.00816.66
7.4.90.0110.00816.50
7.4.80.0080.00819.39
7.4.70.0050.01116.55
7.4.60.0130.01016.50
7.4.50.0070.00216.48
7.4.40.0080.00916.61
7.4.00.0050.01215.01
7.3.330.0020.00213.21
7.3.320.0000.00613.03
7.3.310.0070.00016.33
7.3.300.0000.00716.10
7.3.290.0030.00316.16
7.3.280.0100.00916.22
7.3.260.0120.00716.34
7.3.240.0100.00816.40
7.3.230.0030.01316.43
7.3.210.0070.01016.55
7.3.200.0130.00716.34
7.3.190.0100.01316.33
7.3.180.0030.01216.18
7.3.170.0110.00616.34
7.3.160.0140.00416.41
7.3.120.0170.00315.04
7.3.110.0070.01014.77
7.3.100.0090.00314.53
7.3.90.0000.01414.83
7.3.80.0060.01015.02
7.3.70.0070.00714.63
7.3.60.0030.00614.89
7.3.50.0110.00614.80
7.3.40.0000.01514.68
7.3.30.0000.00914.86
7.3.20.0060.00616.56
7.3.10.0040.00916.55
7.3.00.0270.00815.69
7.2.330.0090.00916.68
7.2.320.0100.00616.66
7.2.310.0100.00716.72
7.2.300.0070.01116.67
7.2.290.0140.00316.38
7.2.250.0070.01315.13
7.2.240.0100.01015.15
7.2.230.0090.00615.05
7.2.220.0060.00315.04
7.2.210.0040.00815.03
7.2.200.0060.00914.99
7.2.190.0030.00715.19
7.2.180.0060.00614.99
7.2.170.0110.00414.96
7.2.130.0470.00615.05
7.2.120.0400.00714.98
7.2.110.0610.01615.07
7.2.100.0470.00314.96
7.2.90.0320.01015.25
7.2.80.0450.00714.83
7.2.70.0430.00714.92
7.2.60.0410.00715.05
7.2.50.0590.00615.23
7.2.40.0320.00714.96
7.2.30.0380.00914.93
7.2.20.0490.00314.96
7.2.10.0490.00714.98
7.2.00.0430.01314.86
7.1.330.0060.00615.64
7.1.320.0030.00915.71
7.1.310.0060.00915.91
7.1.300.0070.00716.00
7.1.290.0080.00815.54
7.1.280.0080.00015.77
7.1.270.0060.00915.70
7.1.260.0110.00315.91
7.1.250.0730.00614.03
7.0.330.1640.00313.63
5.6.380.0090.00914.22

preferences:
61.45 ms | 400 KiB | 5 Q