3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sections = array( array( 'name' => 'home', 'uri' => '/', 'title' => 'home'), array( 'name' => 'tech', 'uri' => '/tech', 'title' => 'ux/ui' ), array( 'name' => 'monetization', 'uri' => '/monetization', 'title' => 'monetization' ), array( 'name' => 'contact', 'uri' => '/contact', 'title' => 'contact', 'callToAction' => true, 'desktopTitle' => 'contact us' ), array( 'name' => 'blog', 'uri' => 'https://blog.marfeel.com/blog', 'title' => 'blog', 'external' => true), ); function callToActions($section) { return $section["callToAction"]; } function defaultSections($section) { return !$section["callToAction"]; } function buildSections ($sections) { $index = count($sections); echo $index; while($index) { $section = $sections[--$index]; echo "wololoooooo"; print_r($section); echo '<li> <a href="'. $section["uri"] . '">' . ($section["desktopTitle"]? ucfirst($section["desktopTitle"]): ucfirst($section["title"])) . '</a> </li>'; } } buildSections(array_filter($sections, callToActions)); //print_r(array_filter($sections, defaultSections));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ahFSP
function name:  (null)
number of ops:  10
compiled vars:  !0 = $sections
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   36     1        INIT_FCALL                                               'buildsections'
          2        INIT_FCALL                                               'array_filter'
          3        SEND_VAR                                                 !0
          4        FETCH_CONSTANT                                   ~2      'callToActions'
          5        SEND_VAL                                                 ~2
          6        DO_ICALL                                         $3      
          7        SEND_VAR                                                 $3
          8        DO_FCALL                                      0          
   37     9      > RETURN                                                   1

Function calltoactions:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ahFSP
function name:  callToActions
number of ops:  4
compiled vars:  !0 = $section
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   12     1        FETCH_DIM_R                                      ~1      !0, 'callToAction'
          2      > RETURN                                                   ~1
   13     3*     > RETURN                                                   null

End of function calltoactions

Function defaultsections:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ahFSP
function name:  defaultSections
number of ops:  5
compiled vars:  !0 = $section
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1        FETCH_DIM_R                                      ~1      !0, 'callToAction'
          2        BOOL_NOT                                         ~2      ~1
          3      > RETURN                                                   ~2
   18     4*     > RETURN                                                   null

End of function defaultsections

Function buildsections:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 5
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 23
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 5
Branch analysis from position: 32
Branch analysis from position: 5
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 5
Branch analysis from position: 32
Branch analysis from position: 5
filename:       /in/ahFSP
function name:  buildSections
number of ops:  33
compiled vars:  !0 = $sections, !1 = $index, !2 = $section
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   21     1        COUNT                                            ~3      !0
          2        ASSIGN                                                   !1, ~3
   23     3        ECHO                                                     !1
   25     4      > JMP                                                      ->31
   26     5    >   PRE_DEC                                          ~5      !1
          6        FETCH_DIM_R                                      ~6      !0, ~5
          7        ASSIGN                                                   !2, ~6
   27     8        ECHO                                                     'wololoooooo'
   28     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                                 
   31    12        FETCH_DIM_R                                      ~9      !2, 'uri'
         13        CONCAT                                           ~10     '%3Cli%3E%0A++++++++++++++++++++++++++++++++++++++++%3Ca+href%3D%22', ~9
         14        CONCAT                                           ~11     ~10, '%22%3E'
         15        FETCH_DIM_R                                      ~12     !2, 'desktopTitle'
         16      > JMPZ                                                     ~12, ->23
         17    >   INIT_FCALL                                               'ucfirst'
         18        FETCH_DIM_R                                      ~13     !2, 'desktopTitle'
         19        SEND_VAL                                                 ~13
         20        DO_ICALL                                         $14     
         21        QM_ASSIGN                                        ~15     $14
         22      > JMP                                                      ->28
         23    >   INIT_FCALL                                               'ucfirst'
         24        FETCH_DIM_R                                      ~16     !2, 'title'
         25        SEND_VAL                                                 ~16
         26        DO_ICALL                                         $17     
         27        QM_ASSIGN                                        ~15     $17
         28    >   CONCAT                                           ~18     ~11, ~15
         29        CONCAT                                           ~19     ~18, '%3C%2Fa%3E%0A++++++++++++++++++++++++++++++++++++%3C%2Fli%3E'
         30        ECHO                                                     ~19
   25    31    > > JMPNZ                                                    !1, ->5
   34    32    > > RETURN                                                   null

End of function buildsections

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.2 ms | 1403 KiB | 20 Q