3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myArray = array(1,2,3,4,5,6,7); # Your original array $customArray = array(3,6); # Your custom array $VarCount = count($myArray); # Set the default loop count function gallery_nav($myArray, $customArray=NULL, $VarCount) { for($i=1; $i<=$VarCount; $i++) { $Class = NULL; if(in_array($i, $customArray)){ $VarCount++; # Increment extra <li> $Class = "class=\"custom\""; } echo "<li {$Class}><a href=\"#\">{$i}</a></li> "; } } gallery_nav($myArray,$customArray, $VarCount); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PHe03
function name:  (null)
number of ops:  10
compiled vars:  !0 = $myArray, !1 = $customArray, !2 = $VarCount
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, <array>
    4     2        COUNT                                            ~5      !0
          3        ASSIGN                                                   !2, ~5
   17     4        INIT_FCALL                                               'gallery_nav'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        SEND_VAR                                                 !2
          8        DO_FCALL                                      0          
   18     9      > RETURN                                                   1

Function gallery_nav:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 5
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 5
Branch analysis from position: 22
Branch analysis from position: 5
Branch analysis from position: 13
filename:       /in/PHe03
function name:  gallery_nav
number of ops:  23
compiled vars:  !0 = $myArray, !1 = $customArray, !2 = $VarCount, !3 = $i, !4 = $Class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    7     3        ASSIGN                                                   !3, 1
          4      > JMP                                                      ->20
    8     5    >   ASSIGN                                                   !4, null
    9     6        INIT_FCALL                                               'in_array'
          7        SEND_VAR                                                 !3
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $7      
         10      > JMPZ                                                     $7, ->13
   10    11    >   PRE_INC                                                  !2
   11    12        ASSIGN                                                   !4, 'class%3D%22custom%22'
   13    13    >   ROPE_INIT                                     5  ~11     '%3Cli+'
         14        ROPE_ADD                                      1  ~11     ~11, !4
         15        ROPE_ADD                                      2  ~11     ~11, '%3E%3Ca+href%3D%22%23%22%3E'
         16        ROPE_ADD                                      3  ~11     ~11, !3
         17        ROPE_END                                      4  ~10     ~11, '%3C%2Fa%3E%3C%2Fli%3E%0A'
         18        ECHO                                                     ~10
    7    19        PRE_INC                                                  !3
         20    >   IS_SMALLER_OR_EQUAL                                      !3, !2
         21      > JMPNZ                                                    ~15, ->5
   16    22    > > RETURN                                                   null

End of function gallery_nav

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.63 ms | 1005 KiB | 15 Q