3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Div { private array $content = []; private function __construct() { } public static function tag(): self { return new self(); } public function content(... $content) { $new = clone $this; $new->content = array_values($content); return $new; } private function render(): string { $content = ''; foreach ($this->content as $item) { if ($item instanceof Generator) { foreach ($item as $genItem) { $content .= $genItem; } } else { $content .= $item; } } return '<div>' . $content . '</div>'; } final public function __toString(): string { return $this->render(); } } $items = ['blue', 'green', 'red']; echo Div::tag()->content( 'Collors', '<br>', (static function() use ($items): Generator { foreach ($items as $item) { yield Div::tag()->content($item); } })() );

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.5.30.0120.00518.98
8.5.20.0070.01319.52
8.5.10.0110.00916.72
8.5.00.0130.00920.00
8.4.180.0140.00819.75
8.4.170.0120.01020.55
8.4.160.0130.00923.72
8.4.150.0070.00517.74
8.4.140.0110.00917.82
8.4.130.0120.00817.88
8.4.120.0080.00720.63
8.4.110.0090.00218.86
8.4.100.0120.00417.73
8.4.90.0160.00520.66
8.4.80.0090.00920.52
8.4.70.0100.00919.05
8.4.60.0050.00520.66
8.4.50.0110.00817.79
8.4.40.0170.00317.39
8.4.30.0190.00018.61
8.4.20.0140.00719.56
8.4.10.0090.00019.48
8.3.300.0120.00820.90
8.3.290.0120.00820.95
8.3.280.0120.00718.64
8.3.270.0110.00816.84
8.3.260.0110.00716.41
8.3.250.0150.00419.23
8.3.240.0090.01016.86
8.3.230.0050.00416.54
8.3.220.0040.00318.92
8.3.210.0120.00816.82
8.3.200.0060.00516.61
8.3.190.0130.00617.16
8.3.180.0090.00316.83
8.3.170.0040.00419.11
8.3.160.0060.01216.41
8.3.150.0150.00419.02
8.3.140.0050.00316.78
8.3.130.0000.00818.53
8.3.120.0060.00918.90
8.3.110.0030.00616.62
8.3.100.0040.00416.50
8.3.90.0000.01926.77
8.3.80.0070.00320.27
8.3.70.0110.00716.88
8.3.60.0090.00916.75
8.3.50.0100.01018.21
8.3.40.0060.00922.25
8.3.30.0060.00918.66
8.3.20.0040.00424.18
8.3.10.0000.00824.66
8.3.00.0040.00426.16
8.2.300.0150.00622.29
8.2.290.0070.00316.80
8.2.280.0080.01220.16
8.2.270.0080.00017.24
8.2.260.0170.00018.93
8.2.250.0040.00418.21
8.2.240.0100.01018.21
8.2.230.0130.00620.94
8.2.220.0000.00824.06
8.2.210.0070.01126.77
8.2.200.0040.00416.75
8.2.190.0120.00316.75
8.2.180.0100.01025.92
8.2.170.0040.01118.79
8.2.160.0100.00322.96
8.2.150.0000.00725.66
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0040.00420.93
8.2.110.0060.00320.52
8.2.100.0090.00317.91
8.2.90.0050.00319.22
8.2.80.0080.00017.97
8.2.70.0000.00917.75
8.2.60.0000.00817.93
8.2.50.0000.00918.07
8.2.40.0050.00517.62
8.2.30.0030.00717.69
8.2.20.0040.00420.66
8.2.10.0040.00417.63
8.2.00.0090.00019.34
8.1.340.0150.00521.88
8.1.330.0120.00816.24
8.1.320.0110.00816.22
8.1.310.0100.00716.73
8.1.300.0030.00616.38
8.1.290.0090.00030.84
8.1.280.0070.00725.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0070.00323.86
8.1.230.0000.01122.77
8.1.220.0080.00017.77
8.1.210.0080.00018.77
8.1.200.0030.00817.36
8.1.190.0000.00817.63
8.1.180.0000.00818.10
8.1.170.0060.00318.55
8.1.160.0050.00218.91
8.1.150.0040.00418.71
8.1.140.0040.00417.38
8.1.130.0060.00318.84
8.1.120.0000.00917.43
8.1.110.0060.00317.42
8.1.100.0000.00817.32
8.1.90.0000.00717.51
8.1.80.0050.00517.38
8.1.70.0030.00317.48
8.1.60.0000.00817.63
8.1.50.0040.00417.55
8.1.40.0030.00617.57
8.1.30.0060.00317.61
8.1.20.0080.00017.64
8.1.10.0040.00417.65
8.1.00.0120.00317.38
8.0.300.0000.00818.77
8.0.290.0030.00617.18
8.0.280.0070.00218.38
8.0.270.0030.00316.89
8.0.260.0040.00418.46
8.0.250.0000.00716.96
8.0.240.0030.00316.93
8.0.230.0000.00716.98
8.0.220.0000.00816.84
8.0.210.0000.00716.86
8.0.200.0070.00016.93
8.0.190.0000.00716.95
8.0.180.0000.00716.95
8.0.170.0050.00516.82
8.0.160.0040.00416.93
8.0.150.0040.00416.88
8.0.140.0040.00416.84
8.0.130.0070.00816.66
8.0.120.0100.00316.90
8.0.110.0140.00016.79
8.0.100.0180.00016.59
8.0.90.0060.01116.53
8.0.80.0100.00716.54
8.0.70.0150.00016.66
8.0.60.0060.01116.77
8.0.50.0120.00316.77
8.0.30.0130.00416.61
8.0.20.0060.01116.95
8.0.10.0160.00016.60
8.0.00.0090.00616.94
7.4.330.0000.00515.55
7.4.320.0030.00316.48
7.4.300.0000.00716.54
7.4.290.0000.00716.52
7.4.280.0060.00316.46
7.4.270.0050.00316.49
7.4.260.0120.00416.29
7.4.250.0110.00316.41
7.4.240.0050.01016.30
7.4.230.0060.00916.40
7.4.220.0110.00416.15
7.4.210.0080.00716.30
7.4.200.0130.00016.35
7.4.190.0040.01316.49
7.4.180.0110.00416.40
7.4.160.0100.00516.25
7.4.150.0120.00416.51
7.4.140.0120.00916.38
7.4.130.0130.00716.43
7.4.120.0180.00316.48
7.4.110.0160.00316.42
7.4.100.0130.00316.32
7.4.90.0120.00416.14
7.4.80.0110.00416.22
7.4.70.0100.00716.04
7.4.60.0180.00016.34
7.4.50.0120.00416.09
7.4.40.0160.00516.38
7.4.30.0130.00716.42
7.4.20.0180.00416.44
7.4.10.0170.00416.59
7.4.00.0170.00216.36
7.3.330.0170.00516.20
7.3.320.0140.00716.16
7.3.310.0150.00516.25
7.3.300.0150.00316.09
7.3.290.0180.00016.14
7.3.280.0160.00316.30
7.3.270.0160.00516.17
7.3.260.0200.00016.21
7.3.250.0140.00716.20
7.3.240.0110.00816.24
7.3.230.0150.00616.22
7.3.220.0160.00315.94
7.3.210.0110.00816.11
7.3.200.0130.00615.89
7.3.190.0160.00316.11
7.3.180.0040.00416.17
7.3.170.0040.00416.03
7.3.160.0030.00916.17
7.3.150.0080.00316.03
7.3.140.0080.00316.18
7.3.130.0030.00315.93

preferences:
49.29 ms | 1349 KiB | 5 Q