3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.99 ms | 1388 KiB | 23 Q