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

End of function createstringfrommap

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.38 ms | 1394 KiB | 20 Q