3v4l.org

run code in 300+ PHP versions simultaneously
<?php function createStringFromMap($map) { $chars = array('C*'); end($map); $last = key($map); for ($i = $j = $char = 0; $i <= $last; $i++) { $bit = isset($map[$i]) ? $map[$i] : 0; $char |= ($bit << (7 - $j)); if (++$j === 8) { $chars[] = $char; $j = $char = 0; } } return call_user_func_array('pack', $chars); } $map = array(); $map[1] = 1; $map[9] = 1; $map[17] = 1; $map[25] = 1; echo createStringFromMap($map);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fl4Mq
function name:  (null)
number of ops:  14
compiled vars:  !0 = $map
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ASSIGN                                                   !0, <array>
   19     1        ASSIGN_DIM                                               !0, 1
          2        OP_DATA                                                  1
   20     3        ASSIGN_DIM                                               !0, 9
          4        OP_DATA                                                  1
   21     5        ASSIGN_DIM                                               !0, 17
          6        OP_DATA                                                  1
   22     7        ASSIGN_DIM                                               !0, 25
          8        OP_DATA                                                  1
   24     9        INIT_FCALL                                               'createstringfrommap'
         10        SEND_VAR                                                 !0
         11        DO_FCALL                                      0  $6      
         12        ECHO                                                     $6
         13      > RETURN                                                   1

Function createstringfrommap:
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 = 33, Position 2 = 13
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 30
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 13
Branch analysis from position: 33
Branch analysis from position: 13
Branch analysis from position: 30
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 30
Branch analysis from position: 26
Branch analysis from position: 30
filename:       /in/fl4Mq
function name:  createStringFromMap
number of ops:  39
compiled vars:  !0 = $map, !1 = $chars, !2 = $last, !3 = $i, !4 = $j, !5 = $char, !6 = $bit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    5     2        INIT_FCALL                                               'end'
          3        SEND_REF                                                 !0
          4        DO_ICALL                                                 
    6     5        INIT_FCALL                                               'key'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $9      
          8        ASSIGN                                                   !2, $9
    7     9        ASSIGN                                           ~11     !5, 0
         10        ASSIGN                                           ~12     !4, ~11
         11        ASSIGN                                                   !3, ~12
         12      > JMP                                                      ->31
    8    13    >   ISSET_ISEMPTY_DIM_OBJ                         0          !0, !3
         14      > JMPZ                                                     ~14, ->18
         15    >   FETCH_DIM_R                                      ~15     !0, !3
         16        QM_ASSIGN                                        ~16     ~15
         17      > JMP                                                      ->19
         18    >   QM_ASSIGN                                        ~16     0
         19    >   ASSIGN                                                   !6, ~16
    9    20        SUB                                              ~18     7, !4
         21        SL                                               ~19     !6, ~18
         22        ASSIGN_OP                                     9          !5, ~19
   10    23        PRE_INC                                          ~21     !4
         24        IS_IDENTICAL                                             ~21, 8
         25      > JMPZ                                                     ~22, ->30
   11    26    >   ASSIGN_DIM                                               !1
         27        OP_DATA                                                  !5
   12    28        ASSIGN                                           ~24     !5, 0
         29        ASSIGN                                                   !4, ~24
    7    30    >   PRE_INC                                                  !3
         31    >   IS_SMALLER_OR_EQUAL                                      !3, !2
         32      > JMPNZ                                                    ~27, ->13
   15    33    >   INIT_FCALL                                               'pack'
         34        SEND_ARRAY                                               !1
         35        CHECK_UNDEF_ARGS                                         
         36        DO_FCALL                                      0  $28     
         37      > RETURN                                                   $28
   16    38*     > RETURN                                                   null

End of function createstringfrommap

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.18 ms | 1403 KiB | 20 Q