3v4l.org

run code in 300+ PHP versions simultaneously
<?php function IEEE64Float($strHex) { // Thanx Chung Leong https://bytes.com/topic/php/answers/9237-hex-floating-point#post38346 $hex = sscanf($strHex, "%02x%02x%02x%02x%02x%02x%02x%02x"); $hex = array_reverse($hex); $bin = implode('', array_map('chr', $hex)); $array = unpack("dnum", $bin); return $array['num']; } function UnMicrosoftify($fDateValue = 0, $iDateBase = 1900) { //http://stackoverflow.com/q/26589406/795054 if ($iDateBase == 1900) { $iMyDateBase = 25569; //Adjust for the fictional 29-Feb-1900 (Day 60) if ($fDateValue < 60) { --$iMyDateBase; } } else { $iMyDateBase = 24107; } // Perform conversion if ($fDateValue >= 1) { $utcDays = $fDateValue - $iMyDateBase; $iReturnValue = round($utcDays * 86400); if (($iReturnValue <= PHP_INT_MAX) && ($iReturnValue >= -PHP_INT_MAX)) { $iReturnValue = (integer) $iReturnValue; } } else { $hours = round($fDateValue * 24); $mins = round($fDateValue * 1440) - round($hours * 60); $secs = round($fDateValue * 86400) - round($hours * 3600) - round($mins * 60); $iReturnValue = (integer) gmmktime($hours, $mins, $secs); } return $iReturnValue; } function PGODdate($strhex) { return date('Y-m-d', UnMicrosoftify(IEEE64Float($strhex))); } echo PGODdate('FE37E43C8800759C');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hAopB
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   INIT_FCALL                                               'pgoddate'
          1        SEND_VAL                                                 'FE37E43C8800759C'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function ieee64float:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hAopB
function name:  IEEE64Float
number of ops:  27
compiled vars:  !0 = $strHex, !1 = $hex, !2 = $bin, !3 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'sscanf'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%2502x%2502x%2502x%2502x%2502x%2502x%2502x%2502x'
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
    6     6        INIT_FCALL                                               'array_reverse'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $6      
          9        ASSIGN                                                   !1, $6
    7    10        INIT_FCALL                                               'implode'
         11        SEND_VAL                                                 ''
         12        INIT_FCALL                                               'array_map'
         13        SEND_VAL                                                 'chr'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $8      
         16        SEND_VAR                                                 $8
         17        DO_ICALL                                         $9      
         18        ASSIGN                                                   !2, $9
    8    19        INIT_FCALL                                               'unpack'
         20        SEND_VAL                                                 'dnum'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                         $11     
         23        ASSIGN                                                   !3, $11
   10    24        FETCH_DIM_R                                      ~13     !3, 'num'
         25      > RETURN                                                   ~13
   11    26*     > RETURN                                                   null

End of function ieee64float

Function unmicrosoftify:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 27
Branch analysis from position: 12
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 64
Branch analysis from position: 64
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
Branch analysis from position: 23
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 27
Branch analysis from position: 12
Branch analysis from position: 27
filename:       /in/hAopB
function name:  UnMicrosoftify
number of ops:  66
compiled vars:  !0 = $fDateValue, !1 = $iDateBase, !2 = $iMyDateBase, !3 = $utcDays, !4 = $iReturnValue, !5 = $hours, !6 = $mins, !7 = $secs
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV_INIT                                        !0      0
          1        RECV_INIT                                        !1      1900
   15     2        IS_EQUAL                                                 !1, 1900
          3      > JMPZ                                                     ~8, ->9
   16     4    >   ASSIGN                                                   !2, 25569
   19     5        IS_SMALLER                                               !0, 60
          6      > JMPZ                                                     ~10, ->8
   20     7    >   PRE_DEC                                                  !2
          8    > > JMP                                                      ->10
   23     9    >   ASSIGN                                                   !2, 24107
   27    10    >   IS_SMALLER_OR_EQUAL                                      1, !0
         11      > JMPZ                                                     ~13, ->27
   28    12    >   SUB                                              ~14     !0, !2
         13        ASSIGN                                                   !3, ~14
   29    14        INIT_FCALL                                               'round'
         15        MUL                                              ~16     !3, 86400
         16        SEND_VAL                                                 ~16
         17        DO_ICALL                                         $17     
         18        ASSIGN                                                   !4, $17
   30    19        IS_SMALLER_OR_EQUAL                              ~19     !4, 9223372036854775807
         20      > JMPZ_EX                                          ~19     ~19, ->23
         21    >   IS_SMALLER_OR_EQUAL                              ~20     -9223372036854775807, !4
         22        BOOL                                             ~19     ~20
         23    > > JMPZ                                                     ~19, ->26
   31    24    >   CAST                                          4  ~21     !4
         25        ASSIGN                                                   !4, ~21
         26    > > JMP                                                      ->64
   34    27    >   INIT_FCALL                                               'round'
         28        MUL                                              ~23     !0, 24
         29        SEND_VAL                                                 ~23
         30        DO_ICALL                                         $24     
         31        ASSIGN                                                   !5, $24
   35    32        INIT_FCALL                                               'round'
         33        MUL                                              ~26     !0, 1440
         34        SEND_VAL                                                 ~26
         35        DO_ICALL                                         $27     
         36        INIT_FCALL                                               'round'
         37        MUL                                              ~28     !5, 60
         38        SEND_VAL                                                 ~28
         39        DO_ICALL                                         $29     
         40        SUB                                              ~30     $27, $29
         41        ASSIGN                                                   !6, ~30
   36    42        INIT_FCALL                                               'round'
         43        MUL                                              ~32     !0, 86400
         44        SEND_VAL                                                 ~32
         45        DO_ICALL                                         $33     
         46        INIT_FCALL                                               'round'
         47        MUL                                              ~34     !5, 3600
         48        SEND_VAL                                                 ~34
         49        DO_ICALL                                         $35     
         50        SUB                                              ~36     $33, $35
         51        INIT_FCALL                                               'round'
         52        MUL                                              ~37     !6, 60
         53        SEND_VAL                                                 ~37
         54        DO_ICALL                                         $38     
         55        SUB                                              ~39     ~36, $38
         56        ASSIGN                                                   !7, ~39
   37    57        INIT_FCALL                                               'gmmktime'
         58        SEND_VAR                                                 !5
         59        SEND_VAR                                                 !6
         60        SEND_VAR                                                 !7
         61        DO_ICALL                                         $41     
         62        CAST                                          4  ~42     $41
         63        ASSIGN                                                   !4, ~42
   39    64    > > RETURN                                                   !4
   40    65*     > RETURN                                                   null

End of function unmicrosoftify

Function pgoddate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hAopB
function name:  PGODdate
number of ops:  13
compiled vars:  !0 = $strhex
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   RECV                                             !0      
   43     1        INIT_FCALL                                               'date'
          2        SEND_VAL                                                 'Y-m-d'
          3        INIT_FCALL                                               'unmicrosoftify'
          4        INIT_FCALL                                               'ieee64float'
          5        SEND_VAR                                                 !0
          6        DO_FCALL                                      0  $1      
          7        SEND_VAR                                                 $1
          8        DO_FCALL                                      0  $2      
          9        SEND_VAR                                                 $2
         10        DO_ICALL                                         $3      
         11      > RETURN                                                   $3
   44    12*     > RETURN                                                   null

End of function pgoddate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.07 ms | 1407 KiB | 32 Q