3v4l.org

run code in 300+ PHP versions simultaneously
<?php function Dec2Bin($number) { while ($number >= 256) { $bytes[] = (($number / 256) - (floor($number / 256))) * 256; $number = floor($number / 256); } $bytes[] = $number; for ($i=0;$i<count($bytes);$i++) { $binstring = (($i == count($bytes) - 1) ? decbin($bytes[$i]) : str_pad(decbin($bytes[$i]), 8, "0", STR_PAD_LEFT)).$binstring; } return $binstring; } $float = PHP_FLOAT_MAX; $bin = Dec2Bin($float); $length = strlen($bin); echo $bin . PHP_EOL; echo $length .PHP_EOL; echo $length / 8;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ASZbs
function name:  (null)
number of ops:  14
compiled vars:  !0 = $float, !1 = $bin, !2 = $length
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ASSIGN                                                   !0, 1.79769e+308
   17     1        INIT_FCALL                                               'dec2bin'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $4      
          4        ASSIGN                                                   !1, $4
   18     5        STRLEN                                           ~6      !1
          6        ASSIGN                                                   !2, ~6
   20     7        CONCAT                                           ~8      !1, '%0A'
          8        ECHO                                                     ~8
   21     9        CONCAT                                           ~9      !2, '%0A'
         10        ECHO                                                     ~9
   22    11        DIV                                              ~10     !2, 8
         12        ECHO                                                     ~10
   23    13      > RETURN                                                   1

Function dec2bin:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 2
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
2 jumps found. (Code = 44) Position 1 = 49, Position 2 = 22
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 32
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 49, Position 2 = 22
Branch analysis from position: 49
Branch analysis from position: 22
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 49, Position 2 = 22
Branch analysis from position: 49
Branch analysis from position: 22
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 2
Branch analysis from position: 18
Branch analysis from position: 2
filename:       /in/ASZbs
function name:  Dec2Bin
number of ops:  51
compiled vars:  !0 = $number, !1 = $bytes, !2 = $i, !3 = $binstring
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1      > JMP                                                      ->16
    6     2    >   DIV                                              ~5      !0, 256
          3        INIT_FCALL                                               'floor'
          4        DIV                                              ~6      !0, 256
          5        SEND_VAL                                                 ~6
          6        DO_ICALL                                         $7      
          7        SUB                                              ~8      ~5, $7
          8        MUL                                              ~9      ~8, 256
          9        ASSIGN_DIM                                               !1
         10        OP_DATA                                                  ~9
    7    11        INIT_FCALL                                               'floor'
         12        DIV                                              ~10     !0, 256
         13        SEND_VAL                                                 ~10
         14        DO_ICALL                                         $11     
         15        ASSIGN                                                   !0, $11
    5    16    >   IS_SMALLER_OR_EQUAL                                      256, !0
         17      > JMPNZ                                                    ~13, ->2
    9    18    >   ASSIGN_DIM                                               !1
         19        OP_DATA                                                  !0
   10    20        ASSIGN                                                   !2, 0
         21      > JMP                                                      ->46
   11    22    >   COUNT                                            ~16     !1
         23        SUB                                              ~17     ~16, 1
         24        IS_EQUAL                                                 !2, ~17
         25      > JMPZ                                                     ~18, ->32
         26    >   INIT_FCALL                                               'decbin'
         27        FETCH_DIM_R                                      ~19     !1, !2
         28        SEND_VAL                                                 ~19
         29        DO_ICALL                                         $20     
         30        QM_ASSIGN                                        ~21     $20
         31      > JMP                                                      ->43
         32    >   INIT_FCALL                                               'str_pad'
         33        INIT_FCALL                                               'decbin'
         34        FETCH_DIM_R                                      ~22     !1, !2
         35        SEND_VAL                                                 ~22
         36        DO_ICALL                                         $23     
         37        SEND_VAR                                                 $23
         38        SEND_VAL                                                 8
         39        SEND_VAL                                                 '0'
         40        SEND_VAL                                                 0
         41        DO_ICALL                                         $24     
         42        QM_ASSIGN                                        ~21     $24
         43    >   CONCAT                                           ~25     ~21, !3
         44        ASSIGN                                                   !3, ~25
   10    45        PRE_INC                                                  !2
         46    >   COUNT                                            ~28     !1
         47        IS_SMALLER                                               !2, ~28
         48      > JMPNZ                                                    ~29, ->22
   13    49    > > RETURN                                                   !3
   14    50*     > RETURN                                                   null

End of function dec2bin

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.82 ms | 1413 KiB | 20 Q