3v4l.org

run code in 500+ PHP versions simultaneously
<?php $menuData = [ '0' => ['Home'], '1' => ['About'], '2' => ['Contact'], '3' => [ 'Services' => [ 'Web Development', 'Wordpress', 'Mobile App' ], ], ]; echo "<pre>"; echo "<ul class=\"navbar-nav me-auto mb-2 mb-lg-0\">"; foreach ($menuData as $value) { $menuItems = current($value); $isSubArray = is_array($menuItems) || false; if (!$isSubArray) { echo "<li class=\"nav-item\"> <a class=\"nav-link active\" aria-current=\"page\" href=\"#\">"; echo current($value); echo "</a></li>"; } else { echo "<li class=\"nav-item dropdown\">"; echo "<a class=\"nav-link dropdown-toggle\" href=\"#\" id=\"navbarDropdown\" role=\"button\" data-bs-toggle=\"dropdown\" aria-expanded=\"false\">"; echo key($value); echo "</a>"; echo "<ul class=\"dropdown-menu\" aria-labelledby=\"navbarDropdown\">"; foreach ($menuItems as $item) { echo "<li><a class=\"dropdown-item\" href=\"#\">"; echo $item; echo "</a></li>"; } echo "</ul>"; echo "</li>"; } } echo "</ul>"; echo "</pre>";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 40
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 40
Branch analysis from position: 5
2 jumps found. (Code = 47) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 22
2 jumps found. (Code = 77) Position 1 = 31, Position 2 = 36
Branch analysis from position: 31
2 jumps found. (Code = 78) Position 1 = 32, Position 2 = 36
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 36
Branch analysis from position: 12
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
filename:       /in/toFVY
function name:  (null)
number of ops:  44
compiled vars:  !0 = $menuData, !1 = $value, !2 = $menuItems, !3 = $isSubArray, !4 = $item
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   16     1        ECHO                                                         '%3Cpre%3E'
   18     2        ECHO                                                         '%3Cul+class%3D%22navbar-nav+me-auto+mb-2+mb-lg-0%22%3E'
   19     3      > FE_RESET_R                                           $6      !0, ->40
          4    > > FE_FETCH_R                                                   $6, !1, ->40
   20     5    >   INIT_FCALL                                                   'current'
          6        SEND_VAR                                                     !1
          7        DO_ICALL                                             $7      
          8        ASSIGN                                                       !2, $7
   21     9        TYPE_CHECK                                      128  ~9      !2
         10      > JMPNZ_EX                                             ~9      ~9, ->12
         11    >   BOOL                                                 ~9      <false>
         12    >   ASSIGN                                                       !3, ~9
   22    13        BOOL_NOT                                             ~11     !3
         14      > JMPZ                                                         ~11, ->22
   23    15    >   ECHO                                                         '%3Cli+class%3D%22nav-item%22%3E%0A++++++++%3Ca+class%3D%22nav-link+active%22+aria-current%3D%22page%22+href%3D%22%23%22%3E'
   25    16        INIT_FCALL                                                   'current'
         17        SEND_VAR                                                     !1
         18        DO_ICALL                                             $12     
         19        ECHO                                                         $12
   26    20        ECHO                                                         '%3C%2Fa%3E%3C%2Fli%3E'
   22    21      > JMP                                                          ->39
   28    22    >   ECHO                                                         '%3Cli+class%3D%22nav-item+dropdown%22%3E'
   29    23        ECHO                                                         '%3Ca+class%3D%22nav-link+dropdown-toggle%22+href%3D%22%23%22+id%3D%22navbarDropdown%22+role%3D%22button%22+data-bs-toggle%3D%22dropdown%22+aria-expanded%3D%22false%22%3E'
   30    24        INIT_FCALL                                                   'key'
         25        SEND_VAR                                                     !1
         26        DO_ICALL                                             $13     
         27        ECHO                                                         $13
   31    28        ECHO                                                         '%3C%2Fa%3E'
   33    29        ECHO                                                         '%3Cul+class%3D%22dropdown-menu%22+aria-labelledby%3D%22navbarDropdown%22%3E'
   35    30      > FE_RESET_R                                           $14     !2, ->36
         31    > > FE_FETCH_R                                                   $14, !4, ->36
   36    32    >   ECHO                                                         '%3Cli%3E%3Ca+class%3D%22dropdown-item%22+href%3D%22%23%22%3E'
   37    33        ECHO                                                         !4
   38    34        ECHO                                                         '%3C%2Fa%3E%3C%2Fli%3E'
   35    35      > JMP                                                          ->31
         36    >   FE_FREE                                                      $14
   41    37        ECHO                                                         '%3C%2Ful%3E'
   42    38        ECHO                                                         '%3C%2Fli%3E'
   19    39    > > JMP                                                          ->4
         40    >   FE_FREE                                                      $6
   46    41        ECHO                                                         '%3C%2Ful%3E'
   48    42        ECHO                                                         '%3C%2Fpre%3E'
         43      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
186.52 ms | 2041 KiB | 15 Q