3v4l.org

run code in 300+ PHP versions simultaneously
<?php $config = ['legendaryName' => 'legendary_name']; $data = ['legendary_name' => 'The Hammer']; class Warrior { use DbHydrate; private $legendaryName; } trait DbHydrate { public function hydrate($config, $data) { foreach($config as $attributeName => $column) { if(property_exists($this, $attributeName)) { $this->{$attributeName} = $data[$column]; } throw \Exception('The property %s does not exists in %s', $attributeName, self::class); } } } $legendaryWarrior = new Warrior; $legendaryWarrior->hydrate($config, $data); var_dump($legendaryWarrior); $config = ['classicalName' => 'classical_name']; $data = ['classical_name' => 'John']; $testWarrior = new Warrior; $testWarrior->hydrate($config, $data); var_dump($testWarrior);

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.0150.00718.56
8.3.50.0110.01117.98
8.3.40.0070.01118.82
8.3.30.0040.01118.54
8.3.20.0060.00320.18
8.3.10.0040.00423.59
8.3.00.0070.00417.87
8.2.180.0090.00618.45
8.2.170.0070.01122.96
8.2.160.0140.00320.39
8.2.150.0050.00224.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0140.00021.07
8.2.110.0050.00320.52
8.2.100.0110.00017.97
8.2.90.0000.00818.09
8.2.80.0000.00719.28
8.2.70.0050.00317.93
8.2.60.0080.00018.05
8.2.50.0000.00718.10
8.2.40.0000.00820.60
8.2.30.0020.00519.19
8.2.20.0000.00918.17
8.2.10.0050.00318.07
8.2.00.0030.00318.42
8.1.280.0120.00325.92
8.1.270.0030.00522.19
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00623.81
8.1.230.0080.00322.23
8.1.220.0000.00817.79
8.1.210.0030.00618.77
8.1.200.0040.00417.35
8.1.190.0040.00417.22
8.1.180.0060.00318.10
8.1.170.0000.00918.62
8.1.160.0000.00718.90
8.1.150.0040.00420.25
8.1.140.0030.00517.69
8.1.130.0050.00519.03
8.1.120.0050.00217.35
8.1.110.0040.00417.40
8.1.100.0030.00417.41
8.1.90.0000.00817.36
8.1.80.0040.00417.49
8.1.70.0030.00317.45
8.1.60.0000.00817.46
8.1.50.0050.00317.54
8.1.40.0040.00417.41
8.1.30.0000.00817.60
8.1.20.0000.00817.68
8.1.10.0040.00417.60
8.1.00.0040.00417.37
8.0.300.0080.00021.95
8.0.290.0040.00416.75
8.0.280.0000.00718.51
8.0.270.0000.00717.26
8.0.260.0040.00416.91
8.0.250.0070.00017.03
8.0.240.0000.00716.88
8.0.230.0000.00716.91
8.0.220.0030.00516.86
8.0.210.0040.00416.93
8.0.200.0030.00316.99
8.0.190.0030.00616.99
8.0.180.0000.00816.89
8.0.170.0030.00516.98
8.0.160.0040.00416.92
8.0.150.0000.00716.94
8.0.140.0000.00716.93
8.0.130.0060.00013.34
8.0.120.0050.00216.81
8.0.110.0030.00516.90
8.0.100.0040.00416.84
8.0.90.0040.00417.02
8.0.80.0110.00416.91
8.0.70.0000.00816.84
8.0.60.0050.00216.89
8.0.50.0000.00716.85
8.0.30.0130.00617.17
8.0.20.0110.00817.40
8.0.10.0000.00717.09
8.0.00.0080.01316.72
7.4.330.0000.00515.55
7.4.320.0000.00816.60
7.4.300.0000.00716.57
7.4.290.0000.00716.59
7.4.280.0050.00316.55
7.4.270.0040.00416.63
7.4.260.0030.00316.39
7.4.250.0040.00416.65
7.4.240.0040.00316.52
7.4.230.0040.00416.64
7.4.220.0040.00416.60
7.4.210.0110.00716.54
7.4.200.0040.00416.58
7.4.160.0070.01116.65
7.4.150.0110.01117.40
7.4.140.0110.00617.86
7.4.130.0100.00716.55
7.4.120.0100.00716.51
7.4.110.0090.00916.62
7.4.100.0030.01416.61
7.4.90.0000.01716.62
7.4.80.0130.01419.39
7.4.70.0140.00716.45
7.4.60.0070.01516.53
7.4.50.0030.01216.23
7.4.40.0070.01716.50
7.4.00.0070.01015.22
7.3.330.0000.00513.24
7.3.320.0030.00313.43
7.3.310.0000.00716.32
7.3.300.0040.00416.31
7.3.290.0040.01116.41
7.3.280.0100.00816.40
7.3.270.0160.00317.40
7.3.260.0100.00916.49
7.3.240.0070.01116.49
7.3.230.0130.00316.61
7.3.210.0080.00816.56
7.3.200.0090.00916.69
7.3.190.0120.00416.40
7.3.180.0140.00316.68
7.3.170.0030.01616.39
7.3.160.0100.00616.44
7.2.330.0100.00716.80
7.2.320.0070.01416.63
7.2.310.0140.00416.87
7.2.300.0120.01216.84
7.2.290.0130.00716.55
7.2.110.0160.00016.46
7.2.60.0110.00416.87
7.2.20.0750.01617.92
7.2.10.1340.01617.85
7.2.00.0500.01317.99
7.1.200.0070.00715.97
7.1.140.0560.00917.09
7.1.130.0730.00716.73
7.1.120.0630.01416.70
7.1.110.0590.01016.18
7.1.100.0080.00615.94
7.1.90.0830.01315.75
7.1.80.0670.01315.73
7.1.70.0660.00915.19
7.1.60.0760.01832.92
7.1.50.0860.01033.03
7.1.40.0510.02232.71
7.1.30.0790.01432.63
7.1.20.0720.01432.64
7.1.10.0600.01314.80
7.1.00.0310.01114.74

preferences:
140.75 ms | 400 KiB | 5 Q