3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.7 ms | 1396 KiB | 23 Q