3v4l.org

run code in 300+ PHP versions simultaneously
<?php function bchexdec($hex) { if(strlen($hex) == 1) { return hexdec($hex); } else { $remain = substr($hex, 0, -1); $last = substr($hex, -1); return bcadd(bcmul(16, bchexdec($remain)), hexdec($last)); } } function bcdechex($dec) { $last = bcmod($dec, 16); $remain = bcdiv(bcsub($dec, $last), 16); if($remain == 0) { return dechex($last); } else { return bcdechex($remain).dechex($last); } } echo bcdechex(bcadd(bchexdec('ffffffff000000000001586f'), 1));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fXneg
function name:  (null)
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'bcdechex'
          1        INIT_FCALL_BY_NAME                                       'bcadd'
          2        INIT_FCALL                                               'bchexdec'
          3        SEND_VAL                                                 'ffffffff000000000001586f'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR_NO_REF_EX                                       $0
          6        SEND_VAL_EX                                              1
          7        DO_FCALL                                      0  $1      
          8        SEND_VAR                                                 $1
          9        DO_FCALL                                      0  $2      
         10        ECHO                                                     $2
         11      > RETURN                                                   1

Function bchexdec:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fXneg
function name:  bchexdec
number of ops:  36
compiled vars:  !0 = $hex, !1 = $remain, !2 = $last
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        STRLEN                                           ~3      !0
          2        IS_EQUAL                                                 ~3, 1
          3      > JMPZ                                                     ~4, ->9
    5     4    >   INIT_FCALL                                               'hexdec'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $5      
          7      > RETURN                                                   $5
    4     8*       JMP                                                      ->35
    7     9    >   INIT_FCALL                                               'substr'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 0
         12        SEND_VAL                                                 -1
         13        DO_ICALL                                         $6      
         14        ASSIGN                                                   !1, $6
    8    15        INIT_FCALL                                               'substr'
         16        SEND_VAR                                                 !0
         17        SEND_VAL                                                 -1
         18        DO_ICALL                                         $8      
         19        ASSIGN                                                   !2, $8
    9    20        INIT_FCALL_BY_NAME                                       'bcadd'
         21        INIT_FCALL_BY_NAME                                       'bcmul'
         22        SEND_VAL_EX                                              16
         23        INIT_FCALL_BY_NAME                                       'bchexdec'
         24        SEND_VAR_EX                                              !1
         25        DO_FCALL                                      0  $10     
         26        SEND_VAR_NO_REF_EX                                       $10
         27        DO_FCALL                                      0  $11     
         28        SEND_VAR_NO_REF_EX                                       $11
         29        INIT_FCALL                                               'hexdec'
         30        SEND_VAR                                                 !2
         31        DO_ICALL                                         $12     
         32        SEND_VAR_NO_REF_EX                                       $12
         33        DO_FCALL                                      0  $13     
         34      > RETURN                                                   $13
   11    35*     > RETURN                                                   null

End of function bchexdec

Function bcdechex:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 22
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fXneg
function name:  bcdechex
number of ops:  31
compiled vars:  !0 = $dec, !1 = $last, !2 = $remain
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        INIT_FCALL_BY_NAME                                       'bcmod'
          2        SEND_VAR_EX                                              !0
          3        SEND_VAL_EX                                              16
          4        DO_FCALL                                      0  $3      
          5        ASSIGN                                                   !1, $3
   15     6        INIT_FCALL_BY_NAME                                       'bcdiv'
          7        INIT_FCALL_BY_NAME                                       'bcsub'
          8        SEND_VAR_EX                                              !0
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0  $5      
         11        SEND_VAR_NO_REF_EX                                       $5
         12        SEND_VAL_EX                                              16
         13        DO_FCALL                                      0  $6      
         14        ASSIGN                                                   !2, $6
   17    15        IS_EQUAL                                                 !2, 0
         16      > JMPZ                                                     ~8, ->22
   18    17    >   INIT_FCALL                                               'dechex'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                         $9      
         20      > RETURN                                                   $9
   17    21*       JMP                                                      ->30
   20    22    >   INIT_FCALL_BY_NAME                                       'bcdechex'
         23        SEND_VAR_EX                                              !2
         24        DO_FCALL                                      0  $10     
         25        INIT_FCALL                                               'dechex'
         26        SEND_VAR                                                 !1
         27        DO_ICALL                                         $11     
         28        CONCAT                                           ~12     $10, $11
         29      > RETURN                                                   ~12
   22    30*     > RETURN                                                   null

End of function bcdechex

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.2 ms | 1009 KiB | 18 Q