3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class namedClass{ protected $prop; public function __construct($value){ $this->prop = $value; } public function returnProperty($propName){ if( !empty($this->$propName) ){ return $this->$propName; }else{ return null; } } } $standardObject = new namedCLass('The named class'); echo $standardObject->returnProperty('prop')."\n"; class namedExtension extends namedClass{ public function returnProperty($propName){ if( !empty($this->$propName) ){ return $this->$propName.' from standard extenstion'; }else{ return null; } } } $extObject = new namedExtension('The named extension'); echo $extObject->returnProperty('prop')."\n"; $anonObj = new class('The anonymous class') extends namedClass{ public function returnProperty($propName){ if( !empty($this->$propName) ){ return $this->$propName.' from anonymous class'; }else{ return null; } } }; echo $anonObj->returnProperty('prop');
based on SiacH

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).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.2.60.0130.01016.68
7.2.00.0040.00819.48
7.1.200.0110.00315.75
7.1.100.0070.00418.06
7.1.70.0000.00817.08
7.1.60.0110.01419.11
7.1.50.0070.01517.06
7.1.00.0070.07322.36
7.0.200.0000.01016.72
7.0.60.0070.04719.96
7.0.50.0070.08017.90
7.0.40.0100.08720.11
7.0.30.0300.07720.34
7.0.20.0270.04720.16
7.0.10.0030.07020.23
7.0.00.0030.06720.22
5.6.280.0070.05321.03
5.6.210.0170.06020.46
5.6.200.0130.04318.14
5.6.190.0070.08020.48
5.6.180.0500.05320.41
5.6.170.0170.04720.54
5.6.160.0170.07720.39
5.6.150.0100.03318.18
5.6.140.0000.09018.20
5.6.130.0100.08018.16
5.6.120.0130.08721.14
5.6.110.0070.07721.05
5.6.100.0030.05720.96
5.6.90.0030.08021.11
5.6.80.0030.07720.53
5.5.350.0170.03720.30
5.5.340.0100.03318.02
5.5.330.0100.08020.21
5.5.320.0000.04320.34
5.5.310.0430.04020.35
5.5.300.0100.04717.99
5.5.290.0030.04018.07
5.5.280.0130.06320.86
5.5.270.0030.06720.64
5.5.260.0030.07020.78
5.5.250.0030.06320.62
5.5.240.0130.06320.17
5.4.450.0930.05019.42
5.4.440.0900.06019.57
5.4.430.1100.05019.41
5.4.420.0930.05019.23
5.4.410.0800.05719.27
5.4.400.0800.05719.26
5.4.390.0900.06019.26
5.4.380.0770.04719.19
5.4.370.0770.05319.30
5.4.360.0900.05719.19
5.4.350.0930.04719.11
5.4.340.0970.04018.84
5.4.320.0730.05019.25
5.4.310.0770.05719.19
5.4.300.0830.05019.23
5.4.290.0630.05018.85
5.4.280.0670.05318.90
5.4.270.0670.05019.23
5.4.260.0670.05319.01
5.4.250.0600.05319.23
5.4.240.0700.04319.29
5.4.230.0630.05019.22
5.4.220.0670.05019.25
5.4.210.0670.05019.30
5.4.200.0670.04719.25
5.4.190.0900.05719.09
5.4.180.0630.05019.08
5.4.170.0670.05319.24
5.4.160.0670.04719.07
5.4.150.0670.05319.16
5.4.140.0630.05016.44
5.4.130.0600.04716.39
5.4.120.0600.05716.41
5.4.110.0630.05016.30
5.4.100.0770.05716.52
5.4.90.0670.05016.61
5.4.80.0800.03316.54
5.4.70.0200.03716.57
5.4.60.0270.05316.51
5.4.50.0430.04316.51
5.4.40.0300.06316.33
5.4.30.0330.06316.42
5.4.20.0330.03716.53
5.4.10.0330.03716.23
5.3.290.4270.03715.56
5.3.280.4130.04014.66
5.3.270.3900.04014.64
5.3.260.3430.04014.67
5.3.250.0130.03714.69
5.3.240.3170.03714.61
5.3.230.3600.03014.66
5.3.220.3970.04014.58
5.3.210.0330.07714.59
5.3.200.0200.03314.58
5.3.190.3900.03714.66
5.3.180.0370.03714.58