3v4l.org

run code in 300+ PHP versions simultaneously
<?php function _bin16dec($bin) { $num = intval($bin,2); if (0x8000 & $num) { $num = - (0x010000 - $num); } return $num; } $b = "1111111111111010"; echo _bin16dec($b);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YWVZt
function name:  (null)
number of ops:  6
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, '1111111111111010'
   11     1        INIT_FCALL                                               '_bin16dec'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
          5      > RETURN                                                   1

Function _bin16dec:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/YWVZt
function name:  _bin16dec
number of ops:  13
compiled vars:  !0 = $bin, !1 = $num
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'intval'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 2
          4        DO_ICALL                                         $2      
          5        ASSIGN                                                   !1, $2
    5     6        BW_AND                                           ~4      !1, 32768
          7      > JMPZ                                                     ~4, ->11
    6     8    >   SUB                                              ~5      65536, !1
          9        MUL                                              ~6      ~5, -1
         10        ASSIGN                                                   !1, ~6
    8    11    > > RETURN                                                   !1
    9    12*     > RETURN                                                   null

End of function _bin16dec

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.87 ms | 1397 KiB | 16 Q