3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gmp_base_convert($numStr,$base){ $gnum = gmp_init($numStr); return gmp_strval($gnum,$base); } $binary = gmp_base_convert("-65",2); echo "$binary (binary)"; $i = intval($binary,2); $decimal = gmp_base_convert($i,10); echo "\n$decimal (decimal)"; echo @gmp_base_convert("0.5",16); echo "\n",gmp_base_convert("2a4",16);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wn28V
function name:  (null)
number of ops:  36
compiled vars:  !0 = $binary, !1 = $i, !2 = $decimal
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'gmp_base_convert'
          1        SEND_VAL                                                 '-65'
          2        SEND_VAL                                                 2
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !0, $3
   10     5        NOP                                                      
          6        FAST_CONCAT                                      ~5      !0, '+%28binary%29'
          7        ECHO                                                     ~5
   11     8        INIT_FCALL                                               'intval'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 2
         11        DO_ICALL                                         $6      
         12        ASSIGN                                                   !1, $6
   12    13        INIT_FCALL                                               'gmp_base_convert'
         14        SEND_VAR                                                 !1
         15        SEND_VAL                                                 10
         16        DO_FCALL                                      0  $8      
         17        ASSIGN                                                   !2, $8
   13    18        ROPE_INIT                                     3  ~11     '%0A'
         19        ROPE_ADD                                      1  ~11     ~11, !2
         20        ROPE_END                                      2  ~10     ~11, '+%28decimal%29'
         21        ECHO                                                     ~10
   14    22        BEGIN_SILENCE                                    ~13     
         23        INIT_FCALL                                               'gmp_base_convert'
         24        SEND_VAL                                                 '0.5'
         25        SEND_VAL                                                 16
         26        DO_FCALL                                      0  $14     
         27        END_SILENCE                                              ~13
         28        ECHO                                                     $14
   15    29        ECHO                                                     '%0A'
         30        INIT_FCALL                                               'gmp_base_convert'
         31        SEND_VAL                                                 '2a4'
         32        SEND_VAL                                                 16
         33        DO_FCALL                                      0  $15     
         34        ECHO                                                     $15
         35      > RETURN                                                   1

Function gmp_base_convert:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wn28V
function name:  gmp_base_convert
number of ops:  12
compiled vars:  !0 = $numStr, !1 = $base, !2 = $gnum
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL_BY_NAME                                       'gmp_init'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $3      
          5        ASSIGN                                                   !2, $3
    6     6        INIT_FCALL_BY_NAME                                       'gmp_strval'
          7        SEND_VAR_EX                                              !2
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0  $5      
         10      > RETURN                                                   $5
    7    11*     > RETURN                                                   null

End of function gmp_base_convert

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.18 ms | 1403 KiB | 19 Q