3v4l.org

run code in 300+ PHP versions simultaneously
<?php // convert decimal to base 2 without using base_convert or printf $base = 2; $decnum = 23; $num = 23; $stack = array(); while( $num > 0) { $arr[] = $num % $base; // store remainder in array $num = floor($num/$base); // no integer division } var_dump($arr); $wrong = join('',$arr); var_dump($wrong); $cat = join('',array_reverse($arr)); var_dump($cat); printf("%b\n",$decnum); echo base_convert(23,10,2); // now using the stack while( $decnum > 0) { array_push($stack,($num % $base)); // store remainder on stack $decnum = floor($decnum/$base); // no integer division } for ($i=0,$max = count($stack);$i < $max; $i++) { echo array_pop($stack); } echo "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 5
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 48
Branch analysis from position: 60
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
2 jumps found. (Code = 44) Position 1 = 71, Position 2 = 64
Branch analysis from position: 71
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 64
2 jumps found. (Code = 44) Position 1 = 71, Position 2 = 64
Branch analysis from position: 71
Branch analysis from position: 64
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 48
Branch analysis from position: 60
Branch analysis from position: 48
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 5
Branch analysis from position: 15
Branch analysis from position: 5
filename:       /in/VAQt1
function name:  (null)
number of ops:  73
compiled vars:  !0 = $base, !1 = $decnum, !2 = $num, !3 = $stack, !4 = $arr, !5 = $wrong, !6 = $cat, !7 = $i, !8 = $max
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 2
    4     1        ASSIGN                                                   !1, 23
    5     2        ASSIGN                                                   !2, 23
    6     3        ASSIGN                                                   !3, <array>
    8     4      > JMP                                                      ->13
   10     5    >   MOD                                              ~14     !2, !0
          6        ASSIGN_DIM                                               !4
          7        OP_DATA                                                  ~14
   11     8        INIT_FCALL                                               'floor'
          9        DIV                                              ~15     !2, !0
         10        SEND_VAL                                                 ~15
         11        DO_ICALL                                         $16     
         12        ASSIGN                                                   !2, $16
    8    13    >   IS_SMALLER                                               0, !2
         14      > JMPNZ                                                    ~18, ->5
   13    15    >   INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !4
         17        DO_ICALL                                                 
   14    18        INIT_FCALL                                               'join'
         19        SEND_VAL                                                 ''
         20        SEND_VAR                                                 !4
         21        DO_ICALL                                         $20     
         22        ASSIGN                                                   !5, $20
   15    23        INIT_FCALL                                               'var_dump'
         24        SEND_VAR                                                 !5
         25        DO_ICALL                                                 
   16    26        INIT_FCALL                                               'join'
         27        SEND_VAL                                                 ''
         28        INIT_FCALL                                               'array_reverse'
         29        SEND_VAR                                                 !4
         30        DO_ICALL                                         $23     
         31        SEND_VAR                                                 $23
         32        DO_ICALL                                         $24     
         33        ASSIGN                                                   !6, $24
   17    34        INIT_FCALL                                               'var_dump'
         35        SEND_VAR                                                 !6
         36        DO_ICALL                                                 
   18    37        INIT_FCALL                                               'printf'
         38        SEND_VAL                                                 '%25b%0A'
         39        SEND_VAR                                                 !1
         40        DO_ICALL                                                 
   19    41        INIT_FCALL                                               'base_convert'
         42        SEND_VAL                                                 23
         43        SEND_VAL                                                 10
         44        SEND_VAL                                                 2
         45        DO_ICALL                                         $28     
         46        ECHO                                                     $28
   22    47      > JMP                                                      ->58
   24    48    >   INIT_FCALL                                               'array_push'
         49        SEND_REF                                                 !3
         50        MOD                                              ~29     !2, !0
         51        SEND_VAL                                                 ~29
         52        DO_ICALL                                                 
   25    53        INIT_FCALL                                               'floor'
         54        DIV                                              ~31     !1, !0
         55        SEND_VAL                                                 ~31
         56        DO_ICALL                                         $32     
         57        ASSIGN                                                   !1, $32
   22    58    >   IS_SMALLER                                               0, !1
         59      > JMPNZ                                                    ~34, ->48
   27    60    >   ASSIGN                                                   !7, 0
         61        COUNT                                            ~36     !3
         62        ASSIGN                                                   !8, ~36
         63      > JMP                                                      ->69
   28    64    >   INIT_FCALL                                               'array_pop'
         65        SEND_REF                                                 !3
         66        DO_ICALL                                         $38     
         67        ECHO                                                     $38
   27    68        PRE_INC                                                  !7
         69    >   IS_SMALLER                                               !7, !8
         70      > JMPNZ                                                    ~40, ->64
   30    71    >   ECHO                                                     '%0A'
         72      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.41 ms | 1400 KiB | 29 Q