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); while($index) { $section = $sections[--$index]; echo '<li> <a href="' . get_bloginfo('wpurl') . $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/F3AmD
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>
   32     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          
   33     9      > RETURN                                                   1

Function calltoactions:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F3AmD
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/F3AmD
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 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 4
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 22
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 4
Branch analysis from position: 31
Branch analysis from position: 4
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 4
Branch analysis from position: 31
Branch analysis from position: 4
filename:       /in/F3AmD
function name:  buildSections
number of ops:  32
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      > JMP                                                      ->30
   24     4    >   PRE_DEC                                          ~5      !1
          5        FETCH_DIM_R                                      ~6      !0, ~5
          6        ASSIGN                                                   !2, ~6
   27     7        INIT_FCALL_BY_NAME                                       'get_bloginfo'
          8        SEND_VAL_EX                                              'wpurl'
          9        DO_FCALL                                      0  $8      
         10        CONCAT                                           ~9      '%3Cli%3E%0A++++++++++++++++++++++++++++++++++++++++%3Ca+href%3D%22', $8
         11        FETCH_DIM_R                                      ~10     !2, 'uri'
         12        CONCAT                                           ~11     ~9, ~10
         13        CONCAT                                           ~12     ~11, '%22%3E'
         14        FETCH_DIM_R                                      ~13     !2, 'desktopTitle'
         15      > JMPZ                                                     ~13, ->22
         16    >   INIT_FCALL                                               'ucfirst'
         17        FETCH_DIM_R                                      ~14     !2, 'desktopTitle'
         18        SEND_VAL                                                 ~14
         19        DO_ICALL                                         $15     
         20        QM_ASSIGN                                        ~16     $15
         21      > JMP                                                      ->27
         22    >   INIT_FCALL                                               'ucfirst'
         23        FETCH_DIM_R                                      ~17     !2, 'title'
         24        SEND_VAL                                                 ~17
         25        DO_ICALL                                         $18     
         26        QM_ASSIGN                                        ~16     $18
         27    >   CONCAT                                           ~19     ~12, ~16
         28        CONCAT                                           ~20     ~19, '%3C%2Fa%3E%0A++++++++++++++++++++++++++++++++++++%3C%2Fli%3E'
         29        ECHO                                                     ~20
   23    30    > > JMPNZ                                                    !1, ->4
   30    31    > > RETURN                                                   null

End of function buildsections

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.61 ms | 1403 KiB | 18 Q