3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { function define_new_class($class, $code) { if (!class_exists($class)) { $definition = eval($code); } } function bar() { $new_class = "boo"; $this->define_new_class($new_class, "class $new_class {protected function far(){echo 'Far method of class '.get_class(\$this);}}"); $obj = new $new_class(); echo "Current class: " . get_class($this) . "\n"; // foo echo "\$obj class: " . get_class($obj) . "\n"; // boo } } $foo = new foo(); $foo->bar(); $b = new boo(); $b->far();

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.0060.01216.75
8.3.50.0240.01022.11
8.3.40.0040.01818.80
8.3.30.0120.00318.81
8.3.20.0040.00420.35
8.3.10.0030.00523.53
8.3.00.0040.00419.38
8.2.180.0150.00616.75
8.2.170.0100.01022.96
8.2.160.0070.00720.11
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0060.00326.16
8.2.120.0030.00617.63
8.2.110.0070.00322.21
8.2.100.0080.00417.92
8.2.90.0050.00318.95
8.2.80.0040.00717.97
8.2.70.0000.01017.63
8.2.60.0040.00417.79
8.2.50.0000.00818.07
8.2.40.0080.00021.12
8.2.30.0080.00020.51
8.2.20.0040.00417.63
8.2.10.0000.00818.20
8.2.00.0000.00718.13
8.1.280.0140.00425.92
8.1.270.0070.00724.66
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0000.00822.61
8.1.230.0110.00017.64
8.1.220.0050.00317.76
8.1.210.0000.00818.77
8.1.200.0040.00417.36
8.1.190.0030.00717.35
8.1.180.0040.00418.10
8.1.170.0030.00618.96
8.1.160.0040.00421.97
8.1.150.0000.00718.81
8.1.140.0040.00419.63
8.1.130.0030.00317.72
8.1.120.0050.00317.47
8.1.110.0040.00417.48
8.1.100.0050.00217.36
8.1.90.0040.00417.37
8.1.80.0000.00917.38
8.1.70.0000.00717.51
8.1.60.0050.00317.58
8.1.50.0040.00417.56
8.1.40.0060.00317.55
8.1.30.0040.00417.58
8.1.20.0040.00417.61
8.1.10.0000.00817.57
8.1.00.0050.00217.51
8.0.300.0040.00418.77
8.0.290.0080.00016.63
8.0.280.0030.00318.38
8.0.270.0030.00317.32
8.0.260.0030.00317.27
8.0.250.0040.00417.00
8.0.240.0040.00416.93
8.0.230.0030.00316.92
8.0.220.0040.00416.98
8.0.210.0000.00717.00
8.0.200.0000.00716.99
8.0.190.0030.00717.03
8.0.180.0080.00016.89
8.0.170.0000.00716.93
8.0.160.0070.00016.86
8.0.150.0080.00016.82
8.0.140.0040.00416.85
8.0.130.0000.00713.41
8.0.120.0000.00816.84
8.0.110.0000.00816.97
8.0.100.0000.00716.79
8.0.90.0040.00416.96
8.0.80.0030.01716.96
8.0.70.0070.00017.04
8.0.60.0040.00416.99
8.0.50.0000.00716.98
8.0.30.0130.00517.21
8.0.20.0060.01417.40
8.0.10.0040.00416.97
8.0.00.0070.01016.99
7.4.330.0070.00015.08
7.4.320.0030.00316.52
7.4.300.0000.00716.42
7.4.290.0000.00716.55
7.4.280.0030.00616.58
7.4.270.0040.00416.58
7.4.260.0060.00316.56
7.4.250.0040.00416.48
7.4.240.0040.00416.64
7.4.230.0030.00316.69
7.4.220.0120.00616.73
7.4.210.0070.00916.59
7.4.200.0000.00716.64
7.4.160.0040.01116.55
7.4.150.0090.01017.40
7.4.140.0070.01517.86
7.4.130.0120.01016.69
7.4.120.0090.00916.63
7.4.110.0100.01016.55
7.4.100.0070.01016.37
7.4.90.0140.00316.59
7.4.80.0140.00719.39
7.4.70.0100.00716.39
7.4.60.0140.00316.80
7.4.50.0030.00316.66
7.4.40.0120.01216.48
7.4.30.0110.00916.82
7.4.00.0070.00714.88
7.3.330.0030.00313.37
7.3.320.0000.00613.26
7.3.310.0000.00816.31
7.3.300.0000.00716.49
7.3.290.0050.00216.38
7.3.280.0080.00816.40
7.3.270.0150.00317.40
7.3.260.0090.00616.37
7.3.250.0060.01216.47
7.3.240.0090.00816.38
7.3.230.0100.00716.55
7.3.210.0030.01316.50
7.3.200.0100.00716.50
7.3.190.0100.01016.39
7.3.180.0080.00816.50
7.3.170.0150.00616.66
7.3.160.0070.01416.46
7.3.120.0040.01115.10
7.3.110.0070.01014.98
7.3.100.0030.01414.79
7.3.90.0070.01014.77
7.3.80.0060.01014.66
7.3.70.0070.01014.83
7.3.60.0040.00714.93
7.3.50.0090.00614.75
7.3.40.0060.00314.89
7.3.30.0070.00314.51
7.3.20.0030.01016.62
7.3.10.0040.01116.57
7.3.00.0110.00316.75
7.2.330.0140.00316.72
7.2.320.0070.01116.46
7.2.310.0060.01016.63
7.2.300.0090.00916.69
7.2.290.0180.00416.70
7.2.250.0120.00614.91
7.2.240.0090.00615.00
7.2.230.0090.00615.03
7.2.220.0090.00914.75
7.2.210.0090.00915.04
7.2.200.0100.00614.96
7.2.190.0000.01515.00
7.2.180.0090.00615.07
7.2.170.0070.00315.04
7.2.160.0030.00915.04
7.2.150.0000.01516.97
7.2.140.0030.00917.00
7.2.130.0070.00716.76
7.2.120.0040.01116.96
7.2.110.0040.00817.02
7.2.100.0040.00816.95
7.2.90.0070.01016.98
7.2.80.0060.01216.89
7.2.70.0070.00317.05
7.2.60.0140.00616.87
7.2.50.0030.01016.71
7.2.40.0030.00916.82
7.2.30.0120.00316.58
7.2.20.0000.01616.83
7.2.10.0030.01017.09
7.2.00.0030.01018.21
7.1.330.0100.00615.82
7.1.320.0160.00015.56
7.1.310.0040.01415.76
7.1.300.0060.00915.88
7.1.290.0090.00315.71
7.1.280.0060.00315.77
7.1.270.0100.00315.87
7.1.260.0070.00315.89
7.1.250.0030.00715.98
7.1.240.0030.00615.77
7.1.230.0070.00715.82
7.1.220.0070.00315.71
7.1.210.0090.00615.84
7.1.200.0020.00915.78
7.1.190.0070.00715.65
7.1.180.0000.01115.49
7.1.170.0030.00615.80
7.1.160.0030.01015.75
7.1.150.0090.00615.93
7.1.140.0060.00615.88
7.1.130.0060.00315.48
7.1.120.0070.00715.82
7.1.110.0080.00615.95
7.1.100.0050.00616.92
7.1.90.0100.00315.74
7.1.80.0040.00415.81
7.1.70.0050.00516.35
7.1.60.0100.00717.66
7.1.50.0090.00816.46
7.1.40.0060.00615.66
7.1.30.0060.01015.91
7.1.20.0000.01115.67
7.1.10.0070.00715.77
7.1.00.0080.03818.86
7.0.330.0000.00815.41
7.0.320.0030.01015.46
7.0.310.0070.00415.49
7.0.300.0040.00415.39
7.0.290.0140.00015.35
7.0.280.0080.00415.41
7.0.270.0030.01015.45
7.0.260.0070.00715.38
7.0.250.0070.00715.53
7.0.240.0070.00715.61
7.0.230.0100.00015.39
7.0.220.0070.00415.45
7.0.210.0060.00615.27
7.0.200.0120.00515.12
7.0.190.0040.00415.45
7.0.180.0030.01015.46
7.0.170.0000.00915.52
7.0.160.0040.00815.36
7.0.150.0030.01015.14
7.0.140.0000.00815.27
7.0.130.0000.00815.15
7.0.120.0030.00715.38
7.0.110.0070.00715.50
7.0.100.0000.00815.15
7.0.90.0060.01015.09
7.0.80.0050.00815.13
7.0.70.0030.00915.15
7.0.60.0100.03617.62
7.0.50.0050.02316.66
7.0.40.0070.02816.59
7.0.30.0210.03716.83
7.0.20.0200.03016.84
7.0.10.0090.03016.74
7.0.00.0070.02316.74
5.6.400.0050.00513.81
5.6.390.0100.00614.00
5.6.380.0060.00914.08
5.6.370.0040.00714.30
5.6.360.0000.01314.12
5.6.350.0000.01014.19
5.6.340.0000.00914.66
5.6.330.0090.00614.28
5.6.320.0030.00714.60
5.6.310.0110.00314.23
5.6.300.0060.00314.50
5.6.290.0050.00314.29
5.6.280.0040.03617.77
5.6.270.0000.00914.14
5.6.260.0120.00314.14
5.6.250.0060.00614.51
5.6.240.0060.00914.34
5.6.230.0040.01114.32
5.6.220.0070.00414.49
5.6.210.0080.03817.45
5.6.200.0080.03816.11
5.6.190.0070.03717.37
5.6.180.0090.02517.57
5.6.170.0050.02817.34
5.6.160.0080.02117.39
5.6.150.0060.04616.30
5.6.140.0050.03016.15
5.6.130.0060.04716.29
5.6.120.0050.04417.77
5.6.110.0100.04217.49
5.6.100.0050.04917.72
5.6.90.0080.04417.54
5.6.80.0080.04417.47
5.6.70.0100.00714.34
5.6.60.0040.00414.05
5.6.50.0030.01414.32
5.6.40.0070.01114.41
5.6.30.0030.01313.97
5.6.20.0090.00414.19
5.6.10.0040.01114.14
5.6.00.0060.01014.22
5.5.380.0100.00614.34
5.5.370.0040.00414.41
5.5.360.0070.00314.30
5.5.350.1570.02017.32
5.5.340.0020.02416.11
5.5.330.0070.03017.46
5.5.320.0170.04217.40
5.5.310.0150.03717.39
5.5.300.0100.04016.16
5.5.290.0080.03516.14
5.5.280.0090.03717.59
5.5.270.0090.04017.51
5.5.260.0080.04817.60
5.5.250.0080.04317.49
5.5.240.0100.03517.21
5.5.230.0060.00614.32
5.5.220.0060.00614.19
5.5.210.0150.00314.34
5.5.200.0070.01014.24
5.5.190.0120.00314.22
5.5.180.0060.00614.25
5.5.170.0000.01514.38
5.5.160.0070.01014.02
5.5.150.0030.01314.02
5.5.140.0060.00314.45
5.5.130.0110.00714.14
5.5.120.0130.00314.04
5.5.110.0040.00714.44
5.5.100.0040.00714.27
5.5.90.0110.00414.22
5.5.80.0000.01514.12
5.5.70.0040.00714.30
5.5.60.0040.01214.31
5.5.50.0060.00914.31
5.5.40.0060.00614.32
5.5.30.0000.01513.79
5.5.20.0060.00614.09
5.5.10.0040.01514.32
5.5.00.0050.00514.06

preferences:
56.64 ms | 401 KiB | 5 Q