3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Using timezone and the given date/time format, creates a UTC DATETIME object for use in a MySQL database. */ function convert_timestamp($timestamp, $timezone) { $tz = new DateTimeZone($timezone); $raw = DateTime::createFromFormat('n/j/Y G:i', $timestamp, $tz); $utc = new DateTimeZone("UTC"); $raw->setTimezone($utc); return $raw->format('Y-m-d G:i:s'); } echo convert_timestamp("7/19/2014 8:00", "CST"); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6NYgn
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'convert_timestamp'
          1        SEND_VAL                                                 '7%2F19%2F2014+8%3A00'
          2        SEND_VAL                                                 'CST'
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
   17     5      > RETURN                                                   1

Function convert_timestamp:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6NYgn
function name:  convert_timestamp
number of ops:  24
compiled vars:  !0 = $timestamp, !1 = $timezone, !2 = $tz, !3 = $raw, !4 = $utc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        NEW                                              $5      'DateTimeZone'
          3        SEND_VAR_EX                                              !1
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !2, $5
   10     6        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          7        SEND_VAL                                                 'n%2Fj%2FY+G%3Ai'
          8        SEND_VAR                                                 !0
          9        SEND_VAR                                                 !2
         10        DO_FCALL                                      0  $8      
         11        ASSIGN                                                   !3, $8
   11    12        NEW                                              $10     'DateTimeZone'
         13        SEND_VAL_EX                                              'UTC'
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !4, $10
   12    16        INIT_METHOD_CALL                                         !3, 'setTimezone'
         17        SEND_VAR_EX                                              !4
         18        DO_FCALL                                      0          
   13    19        INIT_METHOD_CALL                                         !3, 'format'
         20        SEND_VAL_EX                                              'Y-m-d+G%3Ai%3As'
         21        DO_FCALL                                      0  $14     
         22      > RETURN                                                   $14
   14    23*     > RETURN                                                   null

End of function convert_timestamp

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.62 ms | 1398 KiB | 14 Q