3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array ( 0 => 110, 1 => 111, 2 => 112, 3 => 113, 4 => 109, 5 => 114, 6 => 115, 7 => 116, 8 => 117, 9 => 118, 10 => 120, 11 => 119, 12 => 121, 13 => 122, 14 => 123, 15 => 124, 16 => 125, 17 => 163, 18 => 164, 19 => 165, 20 => 166, 21 => 167, 22 => 168, 23 => 126, 24 => 127, 25 => 128, 26 => 129, 27 => 130, 28 => 131, 29 => 132, 30 => 149, 31 => 150, 32 => 151, ); function mapArrayToBin(array $values) { $bin_value = 0; if (is_array($values)) { foreach ($values as $val) { $bin_value += (1 << ($val - 1)); } } return $bin_value; } var_dump(mapArrayToBin($array));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0A6sE
function name:  (null)
number of ops:  8
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   20     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'maparraytobin'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function maparraytobin:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
Branch analysis from position: 11
filename:       /in/0A6sE
function name:  mapArrayToBin
number of ops:  13
compiled vars:  !0 = $values, !1 = $bin_value, !2 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        ASSIGN                                                   !1, 0
   11     2        TYPE_CHECK                                  128          !0
          3      > JMPZ                                                     ~4, ->11
   12     4    > > FE_RESET_R                                       $5      !0, ->10
          5    > > FE_FETCH_R                                               $5, !2, ->10
   13     6    >   SUB                                              ~6      !2, 1
          7        SL                                               ~7      1, ~6
          8        ASSIGN_OP                                     1          !1, ~7
   12     9      > JMP                                                      ->5
         10    >   FE_FREE                                                  $5
   16    11    > > RETURN                                                   !1
   17    12*     > RETURN                                                   null

End of function maparraytobin

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.12 ms | 1389 KiB | 16 Q