3v4l.org

run code in 300+ PHP versions simultaneously
<?php $properties = [ 'name' => ['f'], 'name2' => ['relation->g'], # one possibility 'name3' => ['relation', 'g'], # another possibility, (could just be an explode('->')) 'name4' => ['relation', ['format', 'd-m-Y']], # chaining a 2nd method call ]; class BasicModel { public $f = 123; public function relation() { return new RelatedModel; } public function __get($name) { if (method_exists($this, $name)) { return $this->$name(); } } public function __call($name, $arguments) { if (method_exists($this, $name)) { return call_user_func_array ([$this, $name], $arguments); } } } class RelatedModel extends BasicModel # extends to get __get, __call functionality { public $g = 567; public function format($format) { return $format; # tbi } } # here is implementation $model = new BasicModel; foreach ($properties as $name => $_) { // match $method = $_[0]; // call $data[$name] = consume($model, $method); # here, is there an easy way to support all above? or something very close? } function consume($model, $methods) { var_dump(count($methods)); if (count($methods) == 1) { if (strpos($methods[0], '->') !== false) { // there are '->', so explode and repeat return consume($model, explode('->', $methods)); # second case } return $model->$methods; # first case } else { var_dump('not one', $methods); $part = $model; foreach ($methods as $chainCall) { var_dump($part); $part = $part->$chainCall; } return $part; } } var_dump($data);

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.0190.00421.99
8.3.40.0070.00718.71
8.3.30.0070.00718.67
8.3.20.0050.00220.30
8.3.10.0040.00420.66
8.3.00.0000.00921.73
8.2.180.0070.00716.63
8.2.170.0140.00322.96
8.2.160.0040.01122.09
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0000.00820.94
8.2.120.0080.00026.35
8.2.110.0060.00319.30
8.2.100.0030.00917.84
8.2.90.0040.00419.34
8.2.80.0000.00817.97
8.2.70.0060.00317.75
8.2.60.0040.00418.05
8.2.50.0050.00518.09
8.2.40.0040.00420.55
8.2.30.0080.00019.46
8.2.20.0080.00017.86
8.2.10.0000.00718.22
8.2.00.0040.00418.03
8.1.280.0110.00725.92
8.1.270.0040.01122.06
8.1.260.0000.00828.09
8.1.250.0080.00028.09
8.1.240.0090.00021.27
8.1.230.0040.00717.45
8.1.220.0000.00817.79
8.1.210.0000.00818.77
8.1.200.0090.00017.35
8.1.190.0030.00517.23
8.1.180.0000.00818.10
8.1.170.0030.00618.52
8.1.160.0040.00420.73
8.1.150.0030.00518.98
8.1.140.0040.00419.71
8.1.130.0040.00417.75
8.1.120.0000.00717.57
8.1.110.0040.00417.41
8.1.100.0000.00717.50
8.1.90.0000.00817.48
8.1.80.0050.00517.44
8.1.70.0000.00717.39
8.1.60.0030.00617.66
8.1.50.0000.00917.52
8.1.40.0030.00617.43
8.1.30.0050.00317.59
8.1.20.0040.00417.43
8.1.10.0080.00417.53
8.1.00.0080.00017.55
8.0.300.0040.00418.77
8.0.290.0070.00016.88
8.0.280.0070.00018.53
8.0.270.0070.00017.34
8.0.260.0080.00017.29
8.0.250.0040.00417.03
8.0.240.0040.00417.09
8.0.230.0040.00416.95
8.0.220.0030.00517.02
8.0.210.0030.00316.96
8.0.200.0000.00717.09
8.0.190.0030.00616.99
8.0.180.0000.00816.97
8.0.170.0070.00016.91
8.0.160.0050.00317.04
8.0.150.0000.00717.03
8.0.140.0030.00516.80
8.0.130.0000.00613.32
8.0.120.0090.00016.93
8.0.110.0000.00816.95
8.0.100.0040.00417.01
8.0.90.0040.00417.04
8.0.80.0080.00816.90
8.0.70.0040.00416.97
8.0.60.0040.00416.87
8.0.50.0000.00716.88
8.0.30.0100.00717.13
8.0.20.0080.01417.40
8.0.10.0040.00417.12
8.0.00.0100.00616.87
7.4.330.0000.00516.82
7.4.320.0060.00016.62
7.4.300.0030.00316.64
7.4.290.0080.00016.57
7.4.280.0000.00716.52
7.4.270.0090.00016.55
7.4.260.0040.00416.50
7.4.250.0050.00316.57
7.4.240.0040.00416.63
7.4.230.0000.00716.62
7.4.220.0090.00916.63
7.4.210.0070.01116.69
7.4.200.0040.00416.54
7.4.160.0120.00916.55
7.4.150.0090.00917.40
7.4.140.0150.00917.86
7.4.130.0070.01116.59
7.4.120.0110.00716.50
7.4.110.0070.01116.54
7.4.100.0030.01316.60
7.4.90.0110.00816.48
7.4.80.0070.01319.39
7.4.70.0110.01116.68
7.4.60.0100.01016.50
7.4.50.0120.00316.55
7.4.40.0140.00416.50
7.4.30.0120.00816.48
7.4.10.0050.01314.96
7.4.00.0090.00714.88
7.3.330.0030.00313.29
7.3.320.0030.00313.43
7.3.310.0040.00416.45
7.3.300.0030.00316.34
7.3.290.0000.00716.31
7.3.280.0060.01116.48
7.3.270.0110.00717.40
7.3.260.0180.00016.48
7.3.250.0120.00916.54
7.3.240.0110.00716.44
7.3.230.0090.00916.65
7.3.210.0170.00716.43
7.3.200.0120.01016.45
7.3.190.0070.01016.64
7.3.180.0090.01216.54
7.3.170.0060.01316.75
7.3.160.0060.01516.61
7.3.130.0130.00514.89
7.3.120.0070.01014.97
7.3.110.0090.01014.90
7.3.100.0060.00714.84
7.3.90.0090.00614.89
7.3.80.0030.00914.80
7.3.70.0030.01014.94
7.3.60.0040.00814.75
7.3.50.0030.01114.72
7.3.40.0060.00614.79
7.3.30.0040.00814.87
7.3.20.0060.00816.68
7.3.10.0090.00516.64
7.3.00.0070.00716.66
7.2.330.0160.00616.70
7.2.320.0120.00616.57
7.2.310.0110.00716.61
7.2.300.0140.00916.68
7.2.290.0100.01016.81
7.2.260.0110.00615.22
7.2.250.0090.00814.95
7.2.240.0040.01214.91
7.2.230.0060.01015.07
7.2.220.0040.01015.13
7.2.210.0080.00615.20
7.2.200.0070.00615.14
7.2.190.0040.01015.05
7.2.180.0020.01015.15
7.2.170.0070.00615.05
7.2.160.0070.00715.10
7.2.150.0070.00516.97
7.2.140.0060.00816.88
7.2.130.0070.00817.05
7.2.120.0070.00916.87
7.2.110.0100.00416.99
7.2.100.0030.01317.01
7.2.90.0060.01116.87
7.2.80.0110.00316.99
7.2.70.0070.01016.87
7.2.60.0070.00816.93
7.2.50.0000.01316.87
7.2.40.0060.00516.96
7.2.30.0100.00516.83
7.2.20.0070.00617.02
7.2.10.0100.00416.83
7.2.00.0010.01017.85
7.1.330.0100.00415.87
7.1.320.0040.00815.73
7.1.310.0080.00616.00
7.1.300.0040.01015.72
7.1.290.0050.00915.90
7.1.280.0040.00715.86
7.1.270.0030.01015.88
7.1.260.0030.01115.68
7.1.250.0090.00115.80
7.1.240.0040.00715.78
7.1.230.0040.01015.89
7.1.220.0050.00915.83
7.1.210.0090.00515.92
7.1.200.0040.00815.91
7.1.190.0070.00815.92
7.1.180.0080.00815.79
7.1.170.0070.00715.98
7.1.160.0040.01115.89
7.1.150.0070.01015.62
7.1.140.0040.00615.93
7.1.130.0030.00915.74
7.1.120.0020.01015.68
7.1.110.0090.00315.84
7.1.100.0110.00516.10
7.1.90.0070.00315.90
7.1.80.0030.01016.00
7.1.70.0040.00716.31
7.1.60.0020.01016.94
7.1.50.0100.00716.30
7.1.40.0110.00315.75
7.1.30.0020.01515.77
7.1.20.0080.00315.91
7.1.10.0020.00715.84
7.1.00.0030.03218.04
7.0.330.0030.00815.43
7.0.320.0090.00415.43
7.0.310.0050.00515.40
7.0.300.0040.00915.29
7.0.290.0070.00715.33
7.0.280.0030.01015.31
7.0.270.0050.00915.38
7.0.260.0070.00515.39
7.0.250.0020.00915.45
7.0.240.0020.01115.54
7.0.230.0040.00615.51
7.0.220.0050.00915.46
7.0.210.0080.00715.40
7.0.200.3050.00315.28
7.0.190.0040.00915.52
7.0.180.0040.00415.42
7.0.170.0030.00715.24
7.0.160.0070.00715.44
7.0.150.0040.00815.39
7.0.140.0030.01315.39
7.0.130.0070.00715.58
7.0.120.0020.01015.31
7.0.110.0060.00815.33
7.0.100.0110.00515.31
7.0.90.0110.00615.49
7.0.80.0000.01215.33
7.0.70.0020.00915.33
7.0.60.0070.03217.57
7.0.50.0020.01916.25
7.0.40.0040.02315.76
7.0.30.0140.03215.79
7.0.20.0140.03115.74
7.0.10.0020.03515.78
7.0.00.0020.03815.67
5.6.400.0020.01414.59
5.6.390.0030.00914.50
5.6.380.0070.00514.43
5.6.370.0060.00614.21
5.6.360.0010.01114.23
5.6.350.0050.00814.60
5.6.340.0080.00314.54
5.6.330.0070.00714.46
5.6.320.0050.00814.46
5.6.310.0050.00914.46
5.6.300.0050.01114.43
5.6.290.0050.00914.42
5.6.280.0030.01916.70
5.6.270.0000.01414.45
5.6.260.0050.01214.25
5.6.250.0070.00514.46
5.6.240.0050.01014.31
5.6.230.0030.01314.56
5.6.220.0020.00914.29
5.6.210.0080.03516.53
5.6.200.0060.02415.67
5.6.190.0090.02316.50
5.6.180.0100.02816.59
5.6.170.0140.02716.46
5.6.160.0060.03616.40
5.6.150.0060.01815.71
5.6.140.0030.02815.50
5.6.130.0030.03615.74
5.6.120.0070.02516.56
5.6.110.0050.02116.53
5.6.100.0060.03416.47
5.6.90.0080.02616.70
5.6.80.0060.02816.44
5.6.70.0060.00614.42
5.6.60.0040.00614.21
5.6.50.0080.00614.49
5.6.40.0050.01314.32
5.6.30.0050.00814.33
5.6.20.0060.00814.46
5.6.10.0090.00314.29
5.6.00.0050.01014.47
5.5.380.0060.00814.61
5.5.370.0030.01014.37
5.5.360.0040.00914.23
5.5.350.0090.02216.35
5.5.340.0040.02415.61
5.5.330.0080.01616.35
5.5.320.0150.02616.38
5.5.310.0170.02416.29
5.5.300.0040.02815.43
5.5.290.0040.02615.52
5.5.280.0060.03116.61
5.5.270.0070.02716.45
5.5.260.0040.02616.55
5.5.250.0070.02816.35
5.5.240.0040.01916.24
5.5.230.0060.00614.27
5.5.220.0030.01014.48
5.5.210.0080.00514.31
5.5.200.0070.00714.42
5.5.190.0110.00314.61
5.5.180.0060.00914.40
5.5.170.0040.01014.21
5.5.160.0080.00614.54
5.5.150.0090.00714.42
5.5.140.0060.00814.33
5.5.130.0070.00614.34
5.5.120.0080.00814.36
5.5.110.0070.00914.38
5.5.100.0050.00614.36
5.5.90.0060.00614.13
5.5.80.0030.00614.45
5.5.70.0060.01014.27
5.5.60.0090.00714.43
5.5.50.0060.00914.26
5.5.40.0070.00714.35
5.5.30.0090.00914.06
5.5.20.0070.00514.32
5.5.10.0080.00614.41
5.5.00.0080.00614.32

preferences:
62.47 ms | 401 KiB | 5 Q