3v4l.org

run code in 300+ PHP versions simultaneously
<?php $integer = 0b100101; $binary = decbin($integer); $binaries = str_split($binary, 1); $binaries = array_reverse($binaries); for ($index = 0; $index < count($binaries); $index++) { $current = &$binaries[$index]; $current = str_pad("", ((count($binaries) - 1) - $index), "0") . $current . str_pad("", $index, "0"); $current = bindec($current); if (empty($current)) { //unset($binaries[$index]); } } $binaries = array_values($binaries); var_dump($binaries);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 16
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 40
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 16
Branch analysis from position: 44
Branch analysis from position: 16
Branch analysis from position: 40
filename:       /in/VhBQ1
function name:  (null)
number of ops:  52
compiled vars:  !0 = $integer, !1 = $binary, !2 = $binaries, !3 = $index, !4 = $current
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 37
    4     1        INIT_FCALL                                               'decbin'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $6      
          4        ASSIGN                                                   !1, $6
    5     5        INIT_FCALL                                               'str_split'
          6        SEND_VAR                                                 !1
          7        SEND_VAL                                                 1
          8        DO_ICALL                                         $8      
          9        ASSIGN                                                   !2, $8
    6    10        INIT_FCALL                                               'array_reverse'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                         $10     
         13        ASSIGN                                                   !2, $10
    8    14        ASSIGN                                                   !3, 0
         15      > JMP                                                      ->41
    9    16    >   FETCH_DIM_W                                      $13     !2, !3
         17        ASSIGN_REF                                               !4, $13
   10    18        INIT_FCALL                                               'str_pad'
         19        SEND_VAL                                                 ''
         20        COUNT                                            ~15     !2
         21        SUB                                              ~16     ~15, 1
         22        SUB                                              ~17     ~16, !3
         23        SEND_VAL                                                 ~17
         24        SEND_VAL                                                 '0'
         25        DO_ICALL                                         $18     
         26        CONCAT                                           ~19     $18, !4
         27        INIT_FCALL                                               'str_pad'
         28        SEND_VAL                                                 ''
         29        SEND_VAR                                                 !3
         30        SEND_VAL                                                 '0'
         31        DO_ICALL                                         $20     
         32        CONCAT                                           ~21     ~19, $20
         33        ASSIGN                                                   !4, ~21
   11    34        INIT_FCALL                                               'bindec'
         35        SEND_VAR                                                 !4
         36        DO_ICALL                                         $23     
         37        ASSIGN                                                   !4, $23
   12    38        ISSET_ISEMPTY_CV                                         !4
         39      > JMPZ                                                     ~25, ->40
    8    40    >   PRE_INC                                                  !3
         41    >   COUNT                                            ~27     !2
         42        IS_SMALLER                                               !3, ~27
         43      > JMPNZ                                                    ~28, ->16
   16    44    >   INIT_FCALL                                               'array_values'
         45        SEND_VAR                                                 !2
         46        DO_ICALL                                         $29     
         47        ASSIGN                                                   !2, $29
   18    48        INIT_FCALL                                               'var_dump'
         49        SEND_VAR                                                 !2
         50        DO_ICALL                                                 
         51      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.77 ms | 1404 KiB | 27 Q