3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo getDateAndTime(simplexml_load_string(' <x> <date year="2013" month="12" date="29" day="7"/> <time hour="19" minute="07" second="05" timezone="Eastern" utc-hour="-5" utc-minute="00"/> </x> ')); function getDateAndTime($s) { xmlToDate ( $s->date ) . " " . xmlToTime ( $s->time ); } function xmlToDate($xml) { return $xml ['year'] . "-" . str_pad ( $xml ['month'], 2, '0', STR_PAD_LEFT ) . "-" . str_pad ( $xml ['date'], 2, '0', STR_PAD_LEFT ); } function xmlToTime($xml) { return str_pad ( ($xml ['hour'] - 8 - $xml ['utc-hour']), 2, '0', STR_PAD_LEFT ) . ":" . str_pad ( $xml ['minute'], 2, '0', STR_PAD_LEFT ) . ":00"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DfjLA
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL_BY_NAME                                       'getDateAndTime'
          1        INIT_FCALL                                               'simplexml_load_string'
          2        SEND_VAL                                                 '%0A%3Cx%3E%0A+++%3Cdate+year%3D%222013%22+month%3D%2212%22+date%3D%2229%22+day%3D%227%22%2F%3E%0A+++%3Ctime+hour%3D%2219%22+minute%3D%2207%22+second%3D%2205%22+timezone%3D%22Eastern%22+utc-hour%3D%22-5%22+utc-minute%3D%2200%22%2F%3E%0A%3C%2Fx%3E%0A'
          3        DO_ICALL                                         $0      
          4        SEND_VAR_NO_REF_EX                                       $0
          5        DO_FCALL                                      0  $1      
          6        ECHO                                                     $1
   20     7      > RETURN                                                   1

Function getdateandtime:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DfjLA
function name:  getDateAndTime
number of ops:  15
compiled vars:  !0 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_FCALL_BY_NAME                                       'xmlToDate'
          2        CHECK_FUNC_ARG                                           
          3        FETCH_OBJ_FUNC_ARG                               $1      !0, 'date'
          4        SEND_FUNC_ARG                                            $1
          5        DO_FCALL                                      0  $2      
          6        CONCAT                                           ~3      $2, '+'
          7        INIT_FCALL_BY_NAME                                       'xmlToTime'
          8        CHECK_FUNC_ARG                                           
          9        FETCH_OBJ_FUNC_ARG                               $4      !0, 'time'
         10        SEND_FUNC_ARG                                            $4
         11        DO_FCALL                                      0  $5      
         12        CONCAT                                           ~6      ~3, $5
         13        FREE                                                     ~6
   12    14      > RETURN                                                   null

End of function getdateandtime

Function xmltodate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DfjLA
function name:  xmlToDate
number of ops:  22
compiled vars:  !0 = $xml
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        FETCH_DIM_R                                      ~1      !0, 'year'
          2        CONCAT                                           ~2      ~1, '-'
          3        INIT_FCALL                                               'str_pad'
          4        FETCH_DIM_R                                      ~3      !0, 'month'
          5        SEND_VAL                                                 ~3
          6        SEND_VAL                                                 2
          7        SEND_VAL                                                 '0'
          8        SEND_VAL                                                 0
          9        DO_ICALL                                         $4      
         10        CONCAT                                           ~5      ~2, $4
         11        CONCAT                                           ~6      ~5, '-'
         12        INIT_FCALL                                               'str_pad'
         13        FETCH_DIM_R                                      ~7      !0, 'date'
         14        SEND_VAL                                                 ~7
         15        SEND_VAL                                                 2
         16        SEND_VAL                                                 '0'
         17        SEND_VAL                                                 0
         18        DO_ICALL                                         $8      
         19        CONCAT                                           ~9      ~6, $8
         20      > RETURN                                                   ~9
   16    21*     > RETURN                                                   null

End of function xmltodate

Function xmltotime:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DfjLA
function name:  xmlToTime
number of ops:  23
compiled vars:  !0 = $xml
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   19     1        INIT_FCALL                                               'str_pad'
          2        FETCH_DIM_R                                      ~1      !0, 'hour'
          3        SUB                                              ~2      ~1, 8
          4        FETCH_DIM_R                                      ~3      !0, 'utc-hour'
          5        SUB                                              ~4      ~2, ~3
          6        SEND_VAL                                                 ~4
          7        SEND_VAL                                                 2
          8        SEND_VAL                                                 '0'
          9        SEND_VAL                                                 0
         10        DO_ICALL                                         $5      
         11        CONCAT                                           ~6      $5, '%3A'
         12        INIT_FCALL                                               'str_pad'
         13        FETCH_DIM_R                                      ~7      !0, 'minute'
         14        SEND_VAL                                                 ~7
         15        SEND_VAL                                                 2
         16        SEND_VAL                                                 '0'
         17        SEND_VAL                                                 0
         18        DO_ICALL                                         $8      
         19        CONCAT                                           ~9      ~6, $8
         20        CONCAT                                           ~10     ~9, '%3A00'
         21      > RETURN                                                   ~10
   20    22*     > RETURN                                                   null

End of function xmltotime

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.32 ms | 1400 KiB | 17 Q