3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array ( '#attached' => array ( 'library' => array ( 0 => 'system/base', 1 => 'classy/base', 2 => 'core/normalize', ), 'html_head_link' => array ( 0 => array ( 0 => array ( 'rel' => 'shortcut icon', 'href' => 'http://127.0.0.1/core/misc/favicon.ico', 'type' => 'image/vnd.microsoft.icon', ), ), ), 'html_head' => array ( 0 => array ( 0 => array ( '#tag' => 'meta', '#attributes' => array ( 'charset' => 'utf-8', ), '#weight' => -1000, ), 1 => 'system_meta_content_type', ), 1 => array ( 0 => array ( '#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array ( 'name' => 'Generator', 'content' => 'Drupal 8 (https://www.drupal.org)', ), ), 1 => 'system_meta_generator', ), 2 => array ( 0 => array ( '#tag' => 'meta', '#attributes' => array ( 'name' => 'MobileOptimized', 'content' => 'width', ), ), 1 => 'MobileOptimized', ), 3 => array ( 0 => array ( '#tag' => 'meta', '#attributes' => array ( 'name' => 'HandheldFriendly', 'content' => 'true', ), ), 1 => 'HandheldFriendly', ), 4 => array ( 0 => array ( '#tag' => 'meta', '#attributes' => array ( 'name' => 'viewport', 'content' => 'width=device-width, initial-scale=1.0', ), ), 1 => 'viewport', ), ), ), ); function system_module_test_page_attachments_alter(&$page) { // Remove the HTML5 mobile meta-tags. $meta_tags_to_remove = ['MobileOptimized', 'HandheldFriendly', 'viewport', 'cleartype']; foreach ($page['#attached']['html_head'] as $index => $parts) { if (in_array($parts[1], $meta_tags_to_remove)) { unset($page['#attached']['html_head'][$index]); } } } function processHtmlHead(array $html_head) { $head = []; foreach ($html_head as $index => $item) { list($data, $key) = $item; if (!isset($data['#type'])) { $data['#type'] = 'html_tag'; } $head[$key] = $data; } return $head; } function processHtmlHeadLink(array $html_head_link) { $attached = []; foreach ($html_head_link as $item) { $attributes = $item[0]; $should_add_header = isset($item[1]) ? $item[1] : FALSE; $element = array( '#tag' => 'link', '#attributes' => $attributes, ); $href = $attributes['href']; $attached['html_head'][] = [$element, 'html_head_link:' . $attributes['rel'] . ':' . $href]; if ($should_add_header) { // Also add a HTTP header "Link:". $href = '<' . Html::escape($attributes['href'] . '>'); unset($attributes['href']); $attached['http_header'][] = ['Link', $href . drupal_http_header_attributes($attributes), TRUE]; } } return $attached; } system_module_test_page_attachments_alter($array); $attached = $array['#attached']; $attached = array_merge_recursive($attached, processHtmlHeadLink($attached['html_head_link'])); $head = processHtmlHead($attached['html_head']); print_r($head);

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.0110.00416.73
8.3.50.0080.01422.05
8.3.40.0040.01118.84
8.3.30.0100.00318.71
8.3.20.0040.00420.33
8.3.10.0080.00023.35
8.3.00.0030.00519.38
8.2.180.0070.00716.75
8.2.170.0140.00722.96
8.2.160.0030.01022.20
8.2.150.0090.00024.18
8.2.140.0050.00224.66
8.2.130.0000.00826.16
8.2.120.0090.00017.72
8.2.110.0090.01222.11
8.2.100.0000.01117.93
8.2.90.0040.00419.39
8.2.80.0060.00317.97
8.2.70.0000.00917.75
8.2.60.0000.00818.04
8.2.50.0000.00818.07
8.2.40.0000.00819.34
8.2.30.0050.00220.57
8.2.20.0000.00817.76
8.2.10.0060.00318.15
8.2.00.0050.00218.03
8.1.280.0140.00325.92
8.1.270.0000.00923.67
8.1.260.0030.00526.35
8.1.250.0080.00028.09
8.1.240.0090.00022.55
8.1.230.0070.00417.76
8.1.220.0040.00417.79
8.1.210.0000.01018.77
8.1.200.0040.00417.35
8.1.190.0040.00417.36
8.1.180.0030.00618.10
8.1.170.0060.00318.48
8.1.160.0040.00422.05
8.1.150.0000.00718.85
8.1.140.0050.00319.58
8.1.130.0000.00717.72
8.1.120.0000.00717.37
8.1.110.0000.01017.49
8.1.100.0070.00017.45
8.1.90.0030.00517.53
8.1.80.0050.00317.40
8.1.70.0050.00317.37
8.1.60.0030.00617.59
8.1.50.0040.00417.43
8.1.40.0040.00417.44
8.1.30.0000.00817.64
8.1.20.0040.00417.70
8.1.10.0080.00017.50
8.1.00.0040.00417.45
8.0.300.0000.00818.77
8.0.290.0000.00716.63
8.0.280.0000.00818.39
8.0.270.0070.00017.20
8.0.260.0070.00017.30
8.0.250.0040.00417.05
8.0.240.0030.00316.98
8.0.230.0000.00717.01
8.0.220.0050.00216.93
8.0.210.0040.00416.97
8.0.200.0030.00316.88
8.0.190.0000.00917.01
8.0.180.0040.00416.84
8.0.170.0060.00316.86
8.0.160.0070.00017.00
8.0.150.0030.00516.77
8.0.140.0000.00816.94
8.0.130.0000.00513.34
8.0.120.0030.00516.95
8.0.110.0040.00416.95
8.0.100.0040.00416.81
8.0.90.0030.00516.97
8.0.80.0120.00316.98
8.0.70.0040.00416.84
8.0.60.0040.00416.96
8.0.50.0080.00016.86
8.0.30.0050.01517.06
8.0.20.0100.00817.40
8.0.10.0030.00516.91
8.0.00.0110.00616.78
7.4.330.0050.00015.08
7.4.320.0030.00316.50
7.4.300.0000.00716.57
7.4.290.0070.00016.44
7.4.280.0040.00416.63
7.4.270.0000.00716.53
7.4.260.0070.00016.60
7.4.250.0040.00416.60
7.4.240.0000.00716.62
7.4.230.0040.00416.64
7.4.220.0120.00616.59
7.4.210.0020.01416.66
7.4.200.0000.00716.52
7.4.160.0130.00616.42
7.4.150.0200.00317.40
7.4.140.0140.00617.86
7.4.130.0130.01316.72
7.4.120.0080.01016.55
7.4.110.0150.00616.63
7.4.100.0110.01116.67
7.4.90.0030.01316.63
7.4.80.0060.01119.39
7.4.70.0130.00316.59
7.4.60.0100.00616.52
7.4.50.0080.00016.39
7.4.40.0150.00316.45
7.4.30.0160.00316.38
7.4.00.0030.01415.01
7.3.330.0000.00513.40
7.3.320.0000.00613.32
7.3.310.0070.00016.26
7.3.300.0000.00816.41
7.3.290.0030.00316.26
7.3.280.0080.00816.41
7.3.270.0140.01017.40
7.3.260.0110.00716.66
7.3.240.0090.01216.39
7.3.230.0130.00616.64
7.3.210.0070.01016.35
7.3.200.0030.01316.74
7.3.190.0060.00916.57
7.3.180.0100.00716.38
7.3.170.0070.01016.40
7.3.160.0190.00416.45
7.2.330.0090.00816.96
7.2.320.0090.00916.86
7.2.310.0100.00716.74
7.2.300.0120.00616.88
7.2.290.0060.01016.78
7.2.60.0030.01016.91
7.2.00.0040.01119.30
7.1.200.0000.00815.92
7.1.100.0060.01218.22
7.1.70.0000.00817.21
7.1.60.0090.00619.43
7.1.50.0030.01617.03
7.1.00.0000.08022.37
7.0.200.0510.00714.54
7.0.60.0130.05320.03
7.0.50.0100.05317.95
7.0.40.0100.05720.05
7.0.30.0030.04720.16
7.0.20.0330.07720.06
7.0.10.0000.04720.06
7.0.00.0070.05320.18
5.6.280.0070.04021.16
5.6.210.0130.07020.53
5.6.200.0100.03318.22
5.6.190.0030.08020.68
5.6.180.0400.07320.63
5.6.170.0300.03720.44
5.6.160.0130.07720.48
5.6.150.0130.07318.20
5.6.140.0070.04718.21
5.6.130.0070.07718.16
5.6.120.0070.05721.04
5.6.110.0070.08321.05
5.6.100.0100.04720.99
5.6.90.0330.07321.14
5.6.80.0030.06020.42
5.5.350.0170.03720.32
5.5.340.0100.06317.98
5.5.330.0130.08020.43
5.5.320.0170.04320.36
5.5.310.0270.08020.21
5.5.300.0070.05718.07
5.5.290.0070.05317.95
5.5.280.0070.05720.78
5.5.270.0030.07320.96
5.5.260.0030.07020.79
5.5.250.0030.05320.45
5.5.240.0100.07020.16
5.4.450.0800.07019.49
5.4.440.0700.05719.61
5.4.430.0730.05319.55
5.4.420.0630.05319.60
5.4.410.0530.06019.45
5.4.400.0600.05319.29
5.4.390.0570.06318.83
5.4.380.0230.07019.05
5.4.370.0200.04718.82
5.4.360.0500.07018.84
5.4.350.0930.06319.38
5.4.340.0730.06319.25
5.4.320.0970.05719.36
5.4.310.0730.05319.29
5.4.300.0600.06319.28
5.4.290.0700.04318.84
5.4.280.0670.04319.11
5.4.270.0700.07319.11
5.4.260.0630.06719.21
5.4.250.0770.04718.97
5.4.240.0700.04718.83
5.4.230.0530.05718.82
5.4.220.0730.06019.11
5.4.210.0470.06019.27
5.4.200.0770.05019.28
5.4.190.0670.06319.29
5.4.180.0670.05018.86
5.4.170.0700.06019.24
5.4.160.0600.05018.95
5.4.150.0170.05319.36
5.4.140.0170.06716.34
5.4.130.0100.05016.35
5.4.120.0270.05716.48
5.4.110.0230.04716.56
5.4.100.0170.04716.24
5.4.90.0230.04016.57
5.4.80.0230.04316.27
5.4.70.0200.04716.61
5.4.60.0170.05016.45
5.4.50.0070.05716.58
5.4.40.0200.04716.61
5.4.30.0100.05316.59
5.4.20.0100.05316.27
5.4.10.0100.05716.42
5.4.00.0170.04715.71

preferences:
48.87 ms | 401 KiB | 5 Q