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 extract($config, $data) { $row = []; foreach($config as $attributeName => $column) { if(property_exists($this, $attributeName)) { $row[$column] = $this->{$attributeName}; } else { throw new \Exception(sprintf('The property %s does not exists in %s', $attributeName, self::class)); } } return $row; } public function hydrate($config, $data) { foreach($config as $attributeName => $column) { if(property_exists($this, $attributeName)) { $this->{$attributeName} = $data[$column]; } else { throw new \Exception(sprintf('The property %s does not exists in %s', $attributeName, self::class)); } } } } $legendaryWarrior = new Warrior; $legendaryWarrior->hydrate($config, $data); var_dump($legendaryWarrior->extract($config)); 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.0120.01218.30
8.3.50.0120.00618.16
8.3.40.0120.00318.78
8.3.30.0110.00418.54
8.3.20.0080.00020.38
8.3.10.0030.00523.48
8.3.00.0070.00317.93
8.2.180.0070.00718.38
8.2.170.0110.00722.96
8.2.160.0070.00720.35
8.2.150.0000.00824.18
8.2.140.0050.00324.66
8.2.130.0070.00026.16
8.2.120.0000.00721.09
8.2.110.0090.00020.41
8.2.100.0090.00318.03
8.2.90.0040.00417.97
8.2.80.0090.00019.23
8.2.70.0050.00317.92
8.2.60.0040.00417.93
8.2.50.0040.00418.16
8.2.40.0030.00520.42
8.2.30.0000.00819.42
8.2.20.0060.00318.02
8.2.10.0080.00018.02
8.2.00.0050.00318.38
8.1.280.0070.00725.92
8.1.270.0060.00322.19
8.1.260.0050.00326.35
8.1.250.0050.00328.09
8.1.240.0090.00022.54
8.1.230.0080.00421.04
8.1.220.0040.00417.77
8.1.210.0050.00318.77
8.1.200.0030.00617.35
8.1.190.0000.00817.35
8.1.180.0040.00418.10
8.1.170.0080.00018.71
8.1.160.0000.00718.86
8.1.150.0050.00220.24
8.1.140.0000.00717.72
8.1.130.0030.00518.99
8.1.120.0050.00317.37
8.1.110.0040.00417.51
8.1.100.0060.00317.41
8.1.90.0070.00017.38
8.1.80.0000.00817.39
8.1.70.0000.00717.44
8.1.60.0040.00417.52
8.1.50.0060.00317.52
8.1.40.0070.00017.49
8.1.30.0040.00417.67
8.1.20.0060.00317.57
8.1.10.0040.00417.55
8.1.00.0030.00617.38
8.0.300.0040.00421.91
8.0.290.0050.00316.88
8.0.280.0030.00318.48
8.0.270.0070.00017.32
8.0.260.0030.00516.89
8.0.250.0000.00817.08
8.0.240.0000.00816.91
8.0.230.0000.00717.02
8.0.220.0040.00417.03
8.0.210.0030.00316.91
8.0.200.0040.00416.92
8.0.190.0040.00417.04
8.0.180.0000.00817.07
8.0.170.0040.00416.99
8.0.160.0030.00317.06
8.0.150.0050.00216.80
8.0.140.0070.00016.94
8.0.130.0030.00313.39
8.0.120.0040.00416.83
8.0.110.0020.00516.98
8.0.100.0030.00516.85
8.0.90.0060.00317.02
8.0.80.0130.00316.97
8.0.70.0030.00516.84
8.0.60.0040.00416.79
8.0.50.0080.00016.91
8.0.30.0070.01317.04
8.0.20.0090.01017.40
8.0.10.0000.00717.16
8.0.00.0120.00816.84
7.4.330.0000.00615.55
7.4.320.0070.00016.55
7.4.300.0040.00416.49
7.4.290.0030.00316.53
7.4.280.0040.00416.64
7.4.270.0070.00016.52
7.4.260.0000.00716.43
7.4.250.0070.00016.48
7.4.240.0000.00716.49
7.4.230.0000.00716.63
7.4.220.0040.00416.32
7.4.210.0050.00916.60
7.4.200.0040.00416.53
7.4.160.0050.01316.47
7.4.150.0120.00617.40
7.4.140.0110.00717.86
7.4.130.0100.00716.67
7.4.120.0100.00916.62
7.4.110.0140.00316.68
7.4.100.0130.00316.49
7.4.90.0080.00816.54
7.4.80.0090.01019.39
7.4.70.0100.00916.43
7.4.60.0110.00716.69
7.4.50.0040.00816.40
7.4.40.0150.00616.65
7.4.00.0150.00415.06
7.3.330.0000.00613.39
7.3.320.0030.00313.29
7.3.310.0030.00316.39
7.3.300.0040.00416.47
7.3.290.0100.01016.39
7.3.280.0100.00516.41
7.3.270.0130.00317.40
7.3.260.0060.01216.37
7.3.240.0070.01016.49
7.3.230.0120.00416.56
7.3.210.0100.00616.41
7.3.200.0060.00916.62
7.3.190.0060.00916.52
7.3.180.0070.01016.62
7.3.170.0130.00716.65
7.3.160.0090.00616.38
7.3.10.0050.01016.41
7.3.00.0090.00416.49
7.2.330.0060.01616.58
7.2.320.0030.01916.84
7.2.310.0060.01116.88
7.2.300.0150.00916.91
7.2.290.0120.00316.47
7.2.130.0110.00416.75
7.2.120.0060.01116.70
7.2.110.0070.01116.55
7.2.100.0080.00616.59
7.2.90.0070.00816.80
7.2.80.0100.00716.62
7.2.70.0050.01117.09
7.2.60.0080.00916.86
7.2.50.0060.00816.61
7.2.40.0070.01116.81
7.2.30.0090.01116.67
7.2.20.0200.01317.29
7.2.10.0200.01317.18
7.2.00.0210.01117.24
7.1.250.0070.00615.68
7.1.200.0070.00715.66
7.1.140.0380.01017.00
7.1.130.0450.00716.82
7.1.120.0380.01416.99
7.1.110.0470.00016.39
7.1.100.0390.01216.41
7.1.90.0470.01415.90
7.1.80.0400.01016.19
7.1.70.0490.01015.32
7.1.60.0620.01033.38
7.1.50.0570.01332.99
7.1.40.0470.02832.63
7.1.30.0240.02032.76
7.1.20.0570.01732.84
7.1.10.0390.02014.74
7.1.00.0580.01614.86

preferences:
109.14 ms | 401 KiB | 5 Q