3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $foo; protected $bar; protected $baz; } class FooSelfHydratingProxy extends Foo { /** zero-argument constructor since this is just a helper class for hydration */ public function __construct() { } /** * the `Foo` typehint is not part of the interface - here only for the sake of readability/clearness */ public function hydrate($data, Foo $object) { $object->foo = $data['foo']; $object->bar = $data['bar']; $object->baz = $data['baz']; } /** * the `Foo` typehint is not part of the interface - here only for the sake of readability/clearness */ public function extract(Foo $object) { return array('foo' => $object->foo, 'bar' => $object->bar, 'baz' => $object->baz); } } $iterations = 100000; class A {protected $a; protected $b; protected $c;} class AHydrator extends A { public function hydrate(A $a, array $data) { $a->a = $data['a']; $a->b = $data['b']; $a->c = $data['c']; } } $data = array('a' => 1, 'b' => 2, 'c' => 3); $a = new A(); $h = new AHydrator(); for ($i = 0; $i < $iterations; $i++) { $h->hydrate($a, $data); } $iterations = 100000; class A {protected $a; protected $b; protected $c;} $rA = new ReflectionProperty('A', 'a'); $rB = new ReflectionProperty('A', 'b'); $rC = new ReflectionProperty('A', 'c'); $rA->setAccessible(true); $rB->setAccessible(true); $rC->setAccessible(true); $data = array('a' => 1, 'b' => 2, 'c' => 3); $a = new A(); for ($i = 0; $i < $iterations; $i++) { $rA->setValue($a, $data['a']); $rB->setValue($a, $data['b']); $rC->setValue($a, $data['c']); }

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.70.0030.02516.88
8.3.60.0100.01316.63
8.3.50.0100.02221.28
8.3.40.0090.01318.85
8.3.30.0100.01318.63
8.3.20.0000.01120.28
8.3.10.0040.00723.66
8.3.00.0030.00923.61
8.2.190.0070.01716.88
8.2.180.0060.01616.75
8.2.170.0150.00622.96
8.2.160.0070.01421.91
8.2.150.0030.00924.18
8.2.140.0060.00624.66
8.2.130.0060.00626.16
8.2.120.0030.01017.75
8.2.110.0070.01320.38
8.2.100.0060.01217.75
8.2.90.0040.01119.35
8.2.80.0000.01317.97
8.2.70.0100.00717.63
8.2.60.0060.00817.93
8.2.50.0030.01018.07
8.2.40.0000.01319.28
8.2.30.0070.00719.79
8.2.20.0040.01117.95
8.2.10.0030.01018.15
8.2.00.0000.01318.12
8.1.280.0090.01225.92
8.1.270.0060.00620.45
8.1.260.0070.01026.35
8.1.250.0040.00728.09
8.1.240.0070.01022.18
8.1.230.0030.01517.54
8.1.220.0070.00717.80
8.1.210.0030.01018.77
8.1.200.0040.01117.47
8.1.190.0000.01317.48
8.1.180.0030.01018.10
8.1.170.0070.00718.75
8.1.160.0030.01022.00
8.1.150.0040.01219.05
8.1.140.0070.00717.43
8.1.130.0000.01317.73
8.1.120.0000.01317.54
8.1.110.0070.00717.40
8.1.100.0000.01217.41
8.1.90.0030.01017.42
8.1.80.0060.00917.52
8.1.70.0030.01017.39
8.1.60.0030.01417.50
8.1.50.0030.01317.58
8.1.40.0030.01217.61
8.1.30.0060.01017.68
8.1.20.0040.01217.55
8.1.10.0060.01017.61
8.1.00.0000.01617.42
8.0.300.0030.01118.77
8.0.290.0030.01216.88
8.0.280.0030.01018.51
8.0.270.0030.01017.24
8.0.260.0030.00917.33
8.0.250.0030.01017.14
8.0.240.0000.01317.10
8.0.230.0030.01017.02
8.0.220.0000.01216.98
8.0.210.0070.00716.95
8.0.200.0060.00916.99
8.0.190.0000.01616.95
8.0.180.0000.01617.05
8.0.170.0030.01316.90
8.0.160.0030.01317.05
8.0.150.0030.01216.86
8.0.140.0000.01516.87
8.0.130.0000.01413.41
8.0.120.0060.01016.94
8.0.110.0040.01216.96
8.0.100.0000.01616.99
8.0.90.0000.01616.92
8.0.80.0130.02316.93
8.0.70.0030.01216.84
8.0.60.0030.01317.09
8.0.50.0030.01217.01
8.0.30.0070.01717.12
8.0.20.0130.01917.40
8.0.10.0030.01317.04
8.0.00.0110.02116.90
7.4.330.0000.01115.20
7.4.320.0030.01016.57
7.4.300.0030.00916.45
7.4.290.0000.01516.54
7.4.280.0030.01416.55
7.4.270.0000.01616.58
7.4.260.0060.01016.68
7.4.250.0040.01216.57
7.4.240.0020.01416.58
7.4.230.0030.01216.49
7.4.220.0070.02616.50
7.4.210.0060.01916.72
7.4.200.0060.01016.55
7.4.160.0060.02216.57
7.4.150.0090.02217.40
7.4.140.0160.02517.86
7.4.130.0110.02416.66
7.4.120.0160.02316.68
7.4.110.0130.01616.46
7.4.100.0110.03216.53
7.4.90.0070.02316.70
7.4.80.0070.02319.39
7.4.70.0030.02916.46
7.4.60.0150.01316.45
7.4.50.0060.01616.69
7.4.40.0160.02316.71
7.4.30.0160.03116.46
7.4.10.0030.03215.00
7.4.00.0080.02014.94
7.3.330.0040.01313.33
7.3.320.0030.01113.29
7.3.310.0070.01016.50
7.3.300.0000.01616.32
7.3.290.0050.02916.38
7.3.280.0070.03016.38
7.3.270.0040.02717.40
7.3.260.0090.02116.53
7.3.250.0090.02116.49
7.3.240.0120.01816.50
7.3.230.0090.02016.45
7.3.210.0030.02516.61
7.3.200.0090.01916.52
7.3.190.0090.02216.56
7.3.180.0100.02016.52
7.3.170.0000.03116.40
7.3.160.0160.01616.64
7.3.130.0130.02514.70
7.3.120.0000.03514.84
7.3.110.0030.02214.57
7.3.100.0070.02015.00
7.3.90.0030.02214.80
7.3.80.0040.02214.89
7.3.70.0070.01714.96
7.3.60.0030.02414.89
7.3.50.0060.01614.80
7.3.40.0100.02014.79
7.3.30.0030.02014.98
7.3.20.0070.01916.68
7.3.10.0030.02116.60
7.3.00.0020.02416.60
7.2.330.0040.03116.88
7.2.320.0190.03416.53
7.2.310.0060.02516.76
7.2.300.0070.02616.73
7.2.290.0180.02916.86
7.2.260.0100.03114.78
7.2.250.0070.03415.07
7.2.240.0000.02814.79
7.2.230.0070.02215.27
7.2.220.0070.02715.30
7.2.210.0030.03414.73
7.2.200.0070.02014.99
7.2.190.0090.02114.84
7.2.180.0030.02515.04
7.2.170.0100.03314.85
7.2.160.0070.02315.25
7.2.150.0040.02516.77
7.2.140.0070.02716.96
7.2.130.0080.02216.99
7.2.120.0060.03117.02
7.2.110.0070.02316.94
7.2.100.0070.02416.81
7.2.90.0080.02016.93
7.2.80.0020.02617.10
7.2.70.0030.02716.87
7.2.60.0060.02217.00
7.2.50.0080.02016.86
7.2.40.0030.02516.76
7.2.30.0030.02717.16
7.2.20.0100.02417.06
7.2.10.0080.02516.94
7.2.00.0030.03017.67
7.1.330.0000.04015.98
7.1.320.0030.03515.54
7.1.310.0070.03715.79
7.1.300.0000.03515.88
7.1.290.0030.03815.51
7.1.280.0070.04215.84
7.1.270.0070.03415.57
7.1.260.0070.03016.03
7.1.250.0030.03415.92
7.1.240.0060.03415.86
7.1.230.0000.04915.71
7.1.220.0040.03215.84
7.1.210.0030.03515.92
7.1.200.0030.02615.80
7.1.190.0000.04015.55
7.1.180.0030.03015.74
7.1.170.0040.03315.70
7.1.160.0000.03115.70
7.1.150.0030.04015.63
7.1.140.0000.03615.86
7.1.130.0070.03315.71
7.1.120.0100.02615.90
7.1.110.0000.03815.84
7.1.100.0080.02616.92
7.1.90.0030.03615.95
7.1.80.0030.03115.63
7.1.70.0030.02316.61
7.1.60.0100.03217.52
7.1.50.0050.02616.30
7.1.40.0030.02815.77
7.1.30.0000.03315.89
7.1.20.0030.03815.88
7.1.10.0100.03415.91
7.1.00.0020.06719.16
7.0.330.0070.03015.57
7.0.320.0100.02315.30
7.0.310.0000.03915.43
7.0.300.0090.03215.47
7.0.290.0070.03415.12
7.0.280.0070.03315.35
7.0.270.0030.03415.60
7.0.260.0070.03415.49
7.0.250.0000.03715.65
7.0.240.0030.03515.50
7.0.230.0030.03415.52
7.0.220.0000.03715.60
7.0.210.0000.03715.55
7.0.200.0020.02816.24
7.0.190.0030.03515.43
7.0.180.0060.02915.50
7.0.170.0030.03515.58
7.0.160.0030.03715.53
7.0.150.0040.02815.45
7.0.140.0030.03715.45
7.0.130.0070.02915.50
7.0.120.0090.03115.45
7.0.110.0040.03615.43
7.0.100.0060.03215.52
7.0.90.0070.04115.41
7.0.80.0030.04515.66
7.0.70.0060.03215.48
7.0.60.0070.06417.66
7.0.50.0080.05616.76
7.0.40.0070.04516.85
7.0.30.0120.04216.82
7.0.20.0150.06916.95
7.0.10.0070.06216.89
7.0.00.0080.04416.83
5.6.400.0030.05914.64
5.6.390.0070.05614.61
5.6.380.0070.05914.25
5.6.370.0030.07014.29
5.6.360.0000.06014.72
5.6.350.0130.05514.75
5.6.340.0030.05514.63
5.6.330.0070.06314.45
5.6.320.0030.05214.62
5.6.310.0030.05914.34
5.6.300.0000.05614.13
5.6.290.0070.05614.69
5.6.280.0080.07817.87
5.6.270.0030.05714.64
5.6.260.0000.05614.70
5.6.250.0060.06514.40
5.6.240.0030.07714.54
5.6.230.0030.08714.57
5.6.220.0100.05314.53
5.6.210.0070.06317.56
5.6.200.0050.07416.39
5.6.190.0020.06517.29
5.6.180.0220.08817.63
5.6.170.0180.08517.46
5.6.160.0020.06917.40
5.6.150.0050.06816.40
5.6.140.0020.07316.17
5.6.130.0030.06716.30
5.6.120.0100.07617.77
5.6.110.0100.08617.66
5.6.100.0080.08417.73
5.6.90.0050.08717.73
5.6.80.0050.06717.49
5.6.70.0030.05214.38
5.6.60.0070.05614.40
5.6.50.0100.05314.23
5.6.40.0070.05314.29
5.6.30.0070.07114.24
5.6.20.0030.06814.62
5.6.10.0100.05514.27
5.6.00.0000.05514.43
5.5.380.0070.06014.50
5.5.370.0030.08714.26
5.5.360.0030.05814.13
5.5.350.0100.08717.51
5.5.340.0070.06516.31
5.5.330.0030.06217.50
5.5.320.0180.07117.38
5.5.310.0200.07217.44
5.5.300.0080.06716.17
5.5.290.0100.08716.28
5.5.280.0080.08717.68
5.5.270.0050.06417.67
5.5.260.0070.08917.44
5.5.250.0070.06517.52
5.5.240.0030.08417.28
5.5.230.0030.06114.39
5.5.220.0030.05814.64
5.5.210.0030.05914.50
5.5.200.0060.05114.47
5.5.190.0000.06214.13
5.5.180.0000.06214.42
5.5.170.0070.05314.41
5.5.160.0070.04814.40
5.5.150.0070.06614.01
5.5.140.0030.08014.43
5.5.130.0060.05813.96
5.5.120.0070.04914.09
5.5.110.0060.05114.22
5.5.100.0030.05814.43
5.5.90.0000.06414.02
5.5.80.0000.08614.39
5.5.70.0130.07514.28
5.5.60.0000.06014.07
5.5.50.0070.05414.59
5.5.40.0000.06014.36
5.5.30.0060.05514.31
5.5.20.0070.06514.32
5.5.10.0100.05014.36
5.5.00.0060.05514.42
5.4.450.0120.08315.27
5.4.440.0250.08415.23
5.4.430.0230.08115.27
5.4.420.0270.07915.15
5.4.410.0230.08015.21
5.4.400.0420.09215.09
5.4.390.0330.09214.93
5.4.380.0280.08815.26
5.4.370.0270.08715.04
5.4.360.0420.08415.10
5.4.350.0320.08915.09
5.4.340.0400.08915.18
5.4.330.0030.05211.20
5.4.320.0250.08814.93
5.4.310.0350.08815.20
5.4.300.0320.08614.97
5.4.290.0330.09115.08
5.4.280.0330.10014.78
5.4.270.0370.09315.00
5.4.260.0330.11114.88
5.4.250.0350.08015.01
5.4.240.0320.08215.21
5.4.230.0380.08815.02
5.4.220.0300.09614.96
5.4.210.0330.08314.85
5.4.200.0350.10813.91
5.4.190.0330.07515.11
5.4.180.0300.07614.98
5.4.170.0270.07715.16
5.4.160.0300.07015.09
5.4.150.0420.08715.19
5.4.140.0370.10013.75
5.4.130.0350.09613.90
5.4.120.0350.10813.73
5.4.110.0330.09413.59
5.4.100.0280.07813.69
5.4.90.0270.07813.89
5.4.80.0280.07613.89
5.4.70.0280.08113.66
5.4.60.0280.07813.88
5.4.50.0300.07613.80
5.4.40.0300.08013.73
5.4.30.0280.08913.86
5.4.20.0250.08613.82
5.4.10.0350.08113.73
5.4.00.0350.07913.63
5.3.290.0570.18014.60
5.3.280.0700.18714.52
5.3.270.0530.12714.55
5.3.260.0570.14314.71
5.3.250.0670.12314.78
5.3.240.0570.18014.55
5.3.230.0530.12314.53
5.3.220.0570.12714.59
5.3.210.0730.16714.58
5.3.200.0570.13014.61
5.3.190.0800.15014.59
5.3.180.0600.15314.81
5.3.170.0600.12014.61
5.3.160.0800.12314.64
5.3.150.0630.12314.60
5.3.140.0470.13714.59
5.3.130.0470.15314.54
5.3.120.0030.14314.47
5.3.110.0600.13014.80
5.3.100.0730.14314.12
5.3.90.0070.14314.05
5.3.80.0300.17314.06
5.3.70.0630.17013.98
5.3.60.0100.14014.09
5.3.50.0600.15313.84
5.3.40.0600.16713.89
5.3.30.0600.12013.85
5.3.20.0570.11713.73
5.3.10.0600.13313.69
5.3.00.0470.15713.57
5.2.170.0470.14311.01
5.2.160.0600.14311.23
5.2.150.0570.15311.26
5.2.140.0500.13011.08
5.2.130.0370.13311.04
5.2.120.0430.13011.05
5.2.110.0500.18711.14
5.2.100.0530.14011.14
5.2.90.0700.14711.04
5.2.80.0530.13011.20
5.2.70.0530.16711.27
5.2.60.0500.20010.95
5.2.50.0370.13011.05
5.2.40.0230.18310.93
5.2.30.0330.13311.09
5.2.20.0300.14710.88
5.2.10.0370.12710.84
5.2.00.0330.12010.66
5.1.60.0300.1239.93
5.1.50.0400.1109.89
5.1.40.0430.15010.06
5.1.30.0400.15710.29
5.1.20.0430.15710.30
5.1.10.0470.12010.18
5.1.00.0430.12310.14
5.0.50.0230.0278.54
5.0.40.0270.0338.27
5.0.30.0270.0538.13
5.0.20.0270.0208.12
5.0.10.0230.0238.42
5.0.00.0270.0408.02
4.4.90.0200.0207.26
4.4.80.0270.0177.26
4.4.70.0200.0207.26
4.4.60.0130.0277.26
4.4.50.0200.0307.26
4.4.40.0200.0377.26
4.4.30.0230.0207.26
4.4.20.0170.0277.26
4.4.10.0230.0237.26
4.4.00.0170.0377.26
4.3.110.0200.0277.26
4.3.100.0200.0207.26
4.3.90.0170.0207.26
4.3.80.0170.0377.26
4.3.70.0200.0207.26
4.3.60.0200.0237.26
4.3.50.0170.0237.26
4.3.40.0230.0437.26
4.3.30.0070.0307.26
4.3.20.0170.0177.26
4.3.10.0130.0207.26
4.3.00.0000.0235.57

preferences:
71.05 ms | 401 KiB | 5 Q