3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { function __construct($arr) { $this = $arr; $this->a = "hello"; $this->b = "hi"; $this->val = "howdy"; echo $this->a; echo "\n"; echo $this->b; echo "\n"; $val = "a"; echo $this->{$val}; // outputs "hello" echo "\n"; $val = "b"; echo $this->{$val}; // outputs "hi" echo "\n"; echo $this->val; //outputs "howdy" echo "\n"; echo $this->{"val"}; } } $arr = array('a'=>'1','b'=>'2','c'=>'3'); $foo = new foo($arr);

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)
5.4.270.0040.03812.37
5.4.260.0060.04112.37
5.4.250.0070.04012.37
5.4.240.0080.03512.37
5.4.230.0050.03812.36
5.4.220.0090.03612.36
5.4.210.0060.03612.36
5.4.200.0040.03912.36
5.4.190.0100.03112.36
5.4.180.0100.03412.36
5.4.170.0050.03712.37
5.4.160.0030.03912.36
5.4.150.0080.03612.36
5.4.140.0080.04812.04
5.4.130.0110.03312.03
5.4.120.0070.04611.99
5.4.110.0070.03911.98
5.4.100.0100.03211.98
5.4.90.0050.03811.98
5.4.80.0050.04611.98
5.4.70.0100.03411.98
5.4.60.0040.03811.98
5.4.50.0070.04211.98
5.4.40.0060.03811.96
5.4.30.0090.03511.96
5.4.20.0070.03811.97
5.4.10.0090.03511.97
5.4.00.0080.03811.46
5.3.280.0090.04212.71
5.3.270.0090.03812.73
5.3.260.0080.04812.72
5.3.250.0110.04912.72
5.3.240.0020.04212.72
5.3.230.0060.04412.70
5.3.220.0060.03812.68
5.3.210.0080.04312.68
5.3.200.0040.04012.68
5.3.190.0060.03812.68
5.3.180.0080.04512.68
5.3.170.0060.04012.67
5.3.160.0030.05012.68
5.3.150.0070.05312.67
5.3.140.0080.05712.66
5.3.130.0070.05412.66
5.3.120.0070.04612.66
5.3.110.0080.04012.66
5.3.100.0040.04012.11
5.3.90.0060.03812.08
5.3.80.0050.03812.07
5.3.70.0090.03612.07
5.3.60.0060.04012.06
5.3.50.0050.03612.00
5.3.40.0060.03712.00
5.3.30.0060.03511.94
5.3.20.0050.03611.72
5.3.10.0070.04211.68
5.3.00.0100.03411.67
5.2.170.0040.0319.17
5.2.160.0070.0359.17
5.2.150.0060.0409.17
5.2.140.0060.0449.16
5.2.130.0060.0409.13
5.2.120.0050.0419.13
5.2.110.0060.0349.13
5.2.100.0070.0279.13
5.2.90.0030.0409.13
5.2.80.0080.0279.13
5.2.70.0060.0419.12
5.2.60.0060.0349.07
5.2.50.0050.0319.05
5.2.40.0040.0329.02
5.2.30.0090.0359.00
5.2.20.0080.0349.00
5.2.10.0090.0278.90
5.2.00.0080.0288.75
5.1.60.0050.0288.04
5.1.50.0100.0218.04
5.1.40.0080.0268.03
5.1.30.0070.0368.38
5.1.20.0050.0288.40
5.1.10.0080.0268.12
5.1.00.0050.0258.12
5.0.50.0040.0226.60
5.0.40.0040.0206.45
5.0.30.0010.0346.27
5.0.20.0020.0216.25
5.0.10.0020.0226.21
5.0.00.0040.0306.21
4.4.90.0030.0224.78
4.4.80.0050.0154.76
4.4.70.0040.0164.75
4.4.60.0030.0164.75
4.4.50.0030.0174.77
4.4.40.0020.0264.70
4.4.30.0000.0194.75
4.4.20.0040.0144.84
4.4.10.0060.0134.85
4.4.00.0010.0274.76
4.3.110.0020.0174.67
4.3.100.0030.0154.66
4.3.90.0060.0124.63
4.3.80.0020.0254.58
4.3.70.0080.0094.63
4.3.60.0030.0144.63
4.3.50.0040.0154.63
4.3.40.0020.0254.54
4.3.30.0040.0153.29
4.3.20.0000.0183.27
4.3.10.0030.0153.23
4.3.00.0000.0237.17

preferences:
144.9 ms | 1394 KiB | 7 Q