3v4l.org

run code in 300+ PHP versions simultaneously
<?php $bitMask = 5; $bitMask = str_split(strrev((string)(int)$bitMask)); $splited = array(); foreach($bitMask as $pos => $bit) { if (0 != $bit) { $splited[] = pow(2, $pos); //(1 << ($pos - 1)) } } var_dump($splited);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 23
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 23
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 22
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 22
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/ksM89
function name:  (null)
number of ops:  28
compiled vars:  !0 = $bitMask, !1 = $splited, !2 = $bit, !3 = $pos
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 5
    5     1        INIT_FCALL                                               'str_split'
          2        INIT_FCALL                                               'strrev'
          3        CAST                                          4  ~5      !0
          4        CAST                                          6  ~6      ~5
          5        SEND_VAL                                                 ~6
          6        DO_ICALL                                         $7      
          7        SEND_VAR                                                 $7
          8        DO_ICALL                                         $8      
          9        ASSIGN                                                   !0, $8
    7    10        ASSIGN                                                   !1, <array>
    8    11      > FE_RESET_R                                       $11     !0, ->23
         12    > > FE_FETCH_R                                       ~12     $11, !2, ->23
         13    >   ASSIGN                                                   !3, ~12
    9    14        IS_NOT_EQUAL                                             !2, 0
         15      > JMPZ                                                     ~14, ->22
   10    16    >   INIT_FCALL                                               'pow'
         17        SEND_VAL                                                 2
         18        SEND_VAR                                                 !3
         19        DO_ICALL                                         $16     
         20        ASSIGN_DIM                                               !1
         21        OP_DATA                                                  $16
    8    22    > > JMP                                                      ->12
         23    >   FE_FREE                                                  $11
   14    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !1
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.73 ms | 1396 KiB | 21 Q