3v4l.org

run code in 300+ PHP versions simultaneously
<?php function strtod($hex) { preg_match('#([\da-f]+)\.?([\da-f]*)p#i', $hex, $parts); $i = 0; $fractional_part = array_reduce(str_split($parts[2]), function($sum, $part) use (&$i) { $sum += hexdec($part) * pow(16, --$i); return $sum; }); $decimal = (hexdec($parts[1]) + $fractional_part) * pow(2, array_pop(explode('+', $hex))); return $decimal; } $data = '406429c28f5c28f6'; $num = strtod($data); var_dump($num);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p0Hi7
function name:  (null)
number of ops:  9
compiled vars:  !0 = $data, !1 = $num
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ASSIGN                                                   !0, '406429c28f5c28f6'
   18     1        INIT_FCALL                                               'strtod'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   19     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function strtod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p0Hi7
function name:  strtod
number of ops:  38
compiled vars:  !0 = $hex, !1 = $parts, !2 = $i, !3 = $fractional_part, !4 = $decimal
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%23%28%5B%5Cda-f%5D%2B%29%5C.%3F%28%5B%5Cda-f%5D%2A%29p%23i'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
    5     6        ASSIGN                                                   !2, 0
    6     7        INIT_FCALL                                               'array_reduce'
          8        INIT_FCALL                                               'str_split'
          9        FETCH_DIM_R                                      ~7      !1, 2
         10        SEND_VAL                                                 ~7
         11        DO_ICALL                                         $8      
         12        SEND_VAR                                                 $8
         13        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fp0Hi7%3A6%240'
         14        BIND_LEXICAL                                             ~9, !2
   10    15        SEND_VAL                                                 ~9
         16        DO_ICALL                                         $10     
    6    17        ASSIGN                                                   !3, $10
   12    18        INIT_FCALL                                               'hexdec'
         19        FETCH_DIM_R                                      ~12     !1, 1
         20        SEND_VAL                                                 ~12
         21        DO_ICALL                                         $13     
         22        ADD                                              ~14     $13, !3
         23        INIT_FCALL                                               'pow'
         24        SEND_VAL                                                 2
         25        INIT_FCALL                                               'array_pop'
         26        INIT_FCALL                                               'explode'
         27        SEND_VAL                                                 '%2B'
         28        SEND_VAR                                                 !0
         29        DO_ICALL                                         $15     
         30        SEND_VAR_NO_REF                               0          $15
         31        DO_ICALL                                         $16     
         32        SEND_VAR                                                 $16
         33        DO_ICALL                                         $17     
         34        MUL                                              ~18     $17, ~14
         35        ASSIGN                                                   !4, ~18
   14    36      > RETURN                                                   !4
   15    37*     > RETURN                                                   null

End of function strtod

Function %00%7Bclosure%7D%2Fin%2Fp0Hi7%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p0Hi7
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $sum, !1 = $part, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
    7     3        INIT_FCALL                                               'hexdec'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $3      
          6        INIT_FCALL                                               'pow'
          7        SEND_VAL                                                 16
          8        PRE_DEC                                          ~4      !2
          9        SEND_VAL                                                 ~4
         10        DO_ICALL                                         $5      
         11        MUL                                              ~6      $3, $5
         12        ASSIGN_OP                                     1          !0, ~6
    9    13      > RETURN                                                   !0
   10    14*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fp0Hi7%3A6%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.99 ms | 1407 KiB | 30 Q