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) { error_log(var_export($page, TRUE), 3, '/tmp/ff.txt'); // 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]); } } } system_module_test_page_attachments_alter($array); print_r($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LHUfG
function name:  (null)
number of ops:  8
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
  107     1        INIT_FCALL                                               'system_module_test_page_attachments_alter'
          2        SEND_REF                                                 !0
          3        DO_FCALL                                      0          
  109     4        INIT_FCALL                                               'print_r'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function system_module_test_page_attachments_alter:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 26
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 26
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 25
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/LHUfG
function name:  system_module_test_page_attachments_alter
number of ops:  28
compiled vars:  !0 = $page, !1 = $meta_tags_to_remove, !2 = $parts, !3 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   96     0  E >   RECV                                             !0      
   97     1        INIT_FCALL                                               'error_log'
          2        INIT_FCALL                                               'var_export'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $4      
          6        SEND_VAR                                                 $4
          7        SEND_VAL                                                 3
          8        SEND_VAL                                                 '%2Ftmp%2Fff.txt'
          9        DO_ICALL                                                 
   99    10        ASSIGN                                                   !1, <array>
  100    11        FETCH_DIM_R                                      ~7      !0, '%23attached'
         12        FETCH_DIM_R                                      ~8      ~7, 'html_head'
         13      > FE_RESET_R                                       $9      ~8, ->26
         14    > > FE_FETCH_R                                       ~10     $9, !2, ->26
         15    >   ASSIGN                                                   !3, ~10
  101    16        INIT_FCALL                                               'in_array'
         17        FETCH_DIM_R                                      ~12     !2, 1
         18        SEND_VAL                                                 ~12
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                         $13     
         21      > JMPZ                                                     $13, ->25
  102    22    >   FETCH_DIM_UNSET                                  $14     !0, '%23attached'
         23        FETCH_DIM_UNSET                                  $15     $14, 'html_head'
         24        UNSET_DIM                                                $15, !3
  100    25    > > JMP                                                      ->14
         26    >   FE_FREE                                                  $9
  105    27      > RETURN                                                   null

End of function system_module_test_page_attachments_alter

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.93 ms | 1403 KiB | 22 Q