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

End of function createstringfrommap

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.74 ms | 1403 KiB | 20 Q