3v4l.org

run code in 300+ PHP versions simultaneously
<?php //return $this->has_many('Post'); class Foo{ public static $has_manyhg = "Post"; public static $age = "18"; private static $city = "Boston"; public $r=9; public static $has_many = "Post"; public function has_many($a){ return 'hola'; } function get_relationship($val) { $class = new ReflectionClass('Foo'); $staticProperties = $class->getStaticProperties(); $object=new Foo; $model = ucwords(substr($val, 4)); foreach ($staticProperties as $propertyName => $value) { if(preg_match('/^(has_many|age)$/', $propertyName) && $value == $model) { return $object->{$propertyName}($model); } } } } $foo = new Foo; echo $foo->get_relationship('get_post'); ?>

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.00618.30
8.3.50.0120.00921.95
8.3.40.0090.00618.93
8.3.30.0080.00819.13
8.3.20.0040.00420.37
8.3.10.0050.00323.61
8.3.00.0040.00420.89
8.2.180.0150.00316.75
8.2.170.0030.01422.96
8.2.160.0140.00020.53
8.2.150.0040.00424.18
8.2.140.0070.00724.66
8.2.130.0040.01126.16
8.2.120.0040.00419.48
8.2.110.0060.00322.32
8.2.100.0060.00617.91
8.2.90.0040.00419.17
8.2.80.0030.00517.97
8.2.70.0070.00317.75
8.2.60.0000.00817.80
8.2.50.0000.00918.07
8.2.40.0040.00419.86
8.2.30.0000.00818.37
8.2.20.0030.00517.93
8.2.10.0040.00417.99
8.2.00.0000.00819.68
8.1.280.0120.00925.92
8.1.270.0120.00423.71
8.1.260.0040.00426.35
8.1.250.0030.01028.09
8.1.240.0030.00623.89
8.1.230.0040.00818.97
8.1.220.0080.00017.74
8.1.210.0000.00818.77
8.1.200.0060.00617.12
8.1.190.0040.00417.47
8.1.180.0050.00318.10
8.1.170.0060.00318.73
8.1.160.0040.00422.11
8.1.150.0080.00018.81
8.1.140.0000.00717.53
8.1.130.0030.00317.81
8.1.120.0000.00717.63
8.1.110.0060.00317.65
8.1.100.0050.00317.62
8.1.90.0000.00817.68
8.1.80.0040.00417.51
8.1.70.0000.00717.51
8.1.60.0060.00317.75
8.1.50.0040.00417.69
8.1.40.0030.00617.53
8.1.30.0090.00017.82
8.1.20.0000.00817.80
8.1.10.0070.00017.74
8.1.00.0050.00317.70
8.0.300.0000.00718.77
8.0.290.0000.00717.00
8.0.280.0030.00318.38
8.0.270.0030.00317.30
8.0.260.0000.00617.30
8.0.250.0030.00317.07
8.0.240.0100.00017.12
8.0.230.0030.00316.99
8.0.220.0030.00517.09
8.0.210.0030.00317.06
8.0.200.0000.00717.09
8.0.190.0060.00317.02
8.0.180.0040.00417.06
8.0.170.0050.00317.08
8.0.160.0040.00417.03
8.0.150.0050.00217.05
8.0.140.0000.00817.01
8.0.130.0050.00013.58
8.0.120.0040.00417.04
8.0.110.0070.00016.90
8.0.100.0000.00717.06
8.0.90.0040.00417.07
8.0.80.0070.01017.11
8.0.70.0020.00517.02
8.0.60.0040.00416.96
8.0.50.0000.00716.88
8.0.30.0090.01217.25
8.0.20.0100.01017.40
8.0.10.0020.00517.13
8.0.00.0090.00817.20
7.4.330.0000.00615.15
7.4.320.0070.00016.81
7.4.300.0030.00316.71
7.4.290.0030.00316.70
7.4.280.0070.00016.77
7.4.270.0030.00316.76
7.4.260.0030.00316.71
7.4.250.0040.00416.66
7.4.240.0060.00116.77
7.4.230.0040.00416.60
7.4.220.0100.00716.78
7.4.210.0090.00616.92
7.4.200.0000.00716.90
7.4.160.0060.00916.56
7.4.150.0200.00717.40
7.4.140.0160.00817.86
7.4.130.0090.01016.63
7.4.120.0090.00716.68
7.4.110.0090.00916.93
7.4.100.0070.01016.59
7.4.90.0090.00916.86
7.4.80.0080.01119.39
7.4.70.0080.01116.81
7.4.60.0140.00316.64
7.4.50.0050.00316.80
7.4.40.0070.01016.73
7.4.30.0120.00916.66
7.4.00.0090.01015.14
7.3.330.0000.00613.46
7.3.320.0030.00313.40
7.3.310.0040.00416.36
7.3.300.0030.00616.51
7.3.290.0050.00916.47
7.3.280.0090.01216.47
7.3.270.0080.00917.40
7.3.260.0090.00916.93
7.3.250.0120.00616.66
7.3.240.0030.01416.80
7.3.230.0070.01016.83
7.3.210.0060.01016.38
7.3.200.0060.01016.41
7.3.190.0120.00616.89
7.3.180.0060.01016.52
7.3.170.0110.00416.84
7.3.160.0060.01616.50
7.3.120.0050.01014.94
7.3.110.0130.00514.98
7.3.100.0000.01914.79
7.3.90.0070.00715.14
7.3.80.0090.00614.95
7.3.70.0000.01515.10
7.3.60.0100.00614.95
7.3.50.0040.01114.96
7.3.40.0060.00915.16
7.3.30.0030.00715.02
7.3.20.0040.00716.94
7.3.10.0070.01016.85
7.3.00.0070.00716.69
7.2.330.0120.00616.68
7.2.320.0100.01317.01
7.2.310.0090.00916.80
7.2.300.0060.01216.76
7.2.290.0100.00716.84
7.2.250.0030.01315.18
7.2.240.0110.00815.39
7.2.230.0060.01315.25
7.2.220.0060.00315.29
7.2.210.0060.01215.14
7.2.200.0050.00515.23
7.2.190.0090.00615.29
7.2.180.0060.00914.87
7.2.170.0090.00615.01
7.2.00.0070.00719.74
7.1.330.0000.01316.07
7.1.320.0030.00915.97
7.1.310.0090.00915.91
7.1.300.0070.00715.68
7.1.290.0120.00316.14
7.1.280.0070.00716.08
7.1.270.0030.01015.64
7.1.260.0100.00315.98
7.1.100.0100.00718.23
7.1.70.0020.00517.24
7.1.60.0100.01319.70
7.1.50.0150.00716.96
7.1.00.0030.07722.35
7.0.200.0190.00316.91
7.0.140.0070.06722.01
7.0.100.0100.08319.87
7.0.90.0070.08019.85
7.0.80.0100.05019.86
7.0.70.0300.07719.95
7.0.60.0100.06319.95
7.0.50.0500.07320.27
7.0.40.0230.07020.05
7.0.30.0070.08319.90
7.0.20.0030.08720.07
7.0.10.0030.05019.99
7.0.00.0100.04320.02
5.6.280.0000.07720.79
5.6.250.0230.06720.59
5.6.240.0030.05320.59
5.6.230.0100.04320.55
5.6.220.0200.07020.54
5.6.210.0100.04020.52
5.6.200.0130.08721.14
5.6.190.0030.08020.97
5.6.180.0070.04721.06
5.6.170.0030.07720.91
5.6.160.0130.06321.00
5.6.150.0100.06321.05
5.6.140.0100.06020.92
5.6.130.0030.04720.97
5.6.120.0000.04721.12
5.6.110.0100.07321.00
5.6.100.0170.07021.04
5.6.90.0130.07020.95
5.6.80.0000.04720.27
5.6.70.0070.04020.34
5.6.60.0070.06020.39
5.6.50.0030.04720.44
5.6.40.0030.08720.26
5.6.30.0030.03720.43
5.6.20.0070.07020.41
5.6.10.0170.06020.33
5.6.00.0000.04320.30
5.5.380.0070.05720.50
5.5.370.0070.08020.38
5.5.360.0070.08720.44
5.5.350.0130.06720.42
5.5.340.0070.05320.74
5.5.330.0100.07320.88
5.5.320.0100.07720.82
5.5.310.0030.08320.75
5.5.300.0100.05020.84
5.5.290.0100.07320.76
5.5.280.0030.08720.79
5.5.270.0030.05320.75
5.5.260.0130.08020.83
5.5.250.0030.06020.68
5.5.240.0070.04720.18
5.5.230.0070.08320.26
5.5.220.0070.03720.16
5.5.210.0030.04720.13
5.5.200.0100.07020.20
5.5.190.0000.05720.17
5.5.180.0100.07020.07
5.5.160.0000.05020.08
5.5.150.0100.07320.18
5.5.140.0030.08020.13
5.5.130.0100.03720.13
5.5.120.0030.07020.17
5.5.110.0000.04320.22
5.5.100.0000.05720.05
5.5.90.0070.04320.07
5.5.80.0070.06020.11
5.5.70.0000.06020.10
5.5.60.0000.04720.02
5.5.50.0070.03719.99
5.5.40.0030.06319.95
5.5.30.0030.08720.00
5.5.20.0070.07020.03
5.5.10.0130.03319.93
5.5.00.0070.08019.96
5.4.450.0100.08319.33
5.4.440.0070.06719.53
5.4.430.0070.07319.36
5.4.420.0000.04719.22
5.4.410.0030.07319.33
5.4.400.0070.06719.03
5.4.390.0030.06319.12
5.4.380.0130.07018.90
5.4.370.0030.04018.84
5.4.360.0130.06019.04
5.4.350.0100.06319.21
5.4.340.0070.08019.16
5.4.320.0070.04018.95
5.4.310.0070.07318.85
5.4.300.0030.06019.23
5.4.290.0000.04718.90
5.4.280.0030.04319.11
5.4.270.0100.07319.21
5.4.260.0070.04018.89
5.4.250.0100.05719.04
5.4.240.0030.03318.87
5.4.230.0030.05719.12
5.4.220.0100.04319.08
5.4.210.0030.06719.12
5.4.200.0100.07019.11
5.4.190.0100.07718.90
5.4.180.0200.07019.16
5.4.170.0100.04019.04
5.4.160.0130.05319.10
5.4.150.0070.04319.02
5.4.140.0030.07716.39
5.4.130.0100.05016.36
5.4.120.0070.05716.19
5.4.110.0070.05316.42
5.4.100.0100.03016.43
5.4.90.0030.03316.51
5.4.80.0070.04716.51
5.4.70.0070.03316.43
5.4.60.0000.03716.47
5.4.50.0130.06716.39
5.4.40.0030.07016.30
5.4.30.0130.06016.45
5.4.20.0100.06316.48
5.4.10.0070.07016.39
5.4.00.0070.04315.82
5.3.290.0130.07014.68
5.3.280.0070.04714.57
5.3.270.0030.07314.75
5.3.260.0070.05714.60
5.3.250.0100.05014.58
5.3.240.0070.06714.58
5.3.230.0070.04014.59
5.3.220.0000.03714.59
5.3.210.0130.07014.59
5.3.200.0000.04014.58
5.3.190.0170.02314.55
5.3.180.0100.03014.56
5.3.170.0030.03714.69
5.3.160.0070.04714.50
5.3.150.0070.08014.70
5.3.140.0070.06714.49
5.3.130.0130.07314.70
5.3.120.0030.06714.57
5.3.110.0070.07014.61
5.3.100.0130.07014.16
5.3.90.0130.05714.12
5.3.80.0070.05314.00
5.3.70.0030.07714.14
5.3.60.0030.07314.07
5.3.50.0000.06014.07
5.3.40.0130.03013.94
5.3.30.0070.03313.97
5.3.20.0000.04313.69
5.3.10.0130.05713.75
5.3.00.0000.03713.57
5.2.170.0070.03011.26
5.2.160.0100.05311.08
5.2.150.0030.03711.07
5.2.140.0030.04011.26
5.2.130.0000.04011.11
5.2.120.0100.03711.04
5.2.110.0030.03011.20
5.2.100.0000.03311.04
5.2.90.0030.06011.11
5.2.80.0000.03711.14
5.2.70.0030.04311.23
5.2.60.0100.02011.18
5.2.50.0070.04311.14
5.2.40.0030.05710.90
5.2.30.0070.05011.13
5.2.20.0000.04311.09
5.2.10.0000.06010.93
5.2.00.0100.05310.84
5.1.60.0030.05310.09
5.1.50.0100.04310.05
5.1.40.0100.04310.07
5.1.30.0000.03310.36
5.1.20.0100.05710.42
5.1.10.0000.0379.96
5.1.00.0030.04310.16
5.0.50.0030.0438.67
5.0.40.0000.0238.32
5.0.30.0030.0338.28
5.0.20.0070.0308.24
5.0.10.0030.0208.30
5.0.00.0070.0578.17
4.4.90.0000.0306.79
4.4.80.0000.0336.79
4.4.70.0030.0236.79
4.4.60.0000.0206.79
4.4.50.0000.0376.79
4.4.40.0070.0506.79
4.4.30.0000.0206.79
4.4.20.0030.0306.79
4.4.10.0000.0376.79
4.4.00.0000.0376.79
4.3.110.0100.0336.79
4.3.100.0000.0306.79
4.3.90.0000.0336.79
4.3.80.0030.0476.79
4.3.70.0030.0336.79
4.3.60.0000.0206.79
4.3.50.0000.0376.79
4.3.40.0000.0276.79
4.3.30.0000.0176.79
4.3.20.0030.0336.79
4.3.10.0000.0306.79
4.3.00.0000.0206.79

preferences:
46.57 ms | 401 KiB | 5 Q