3v4l.org

run code in 300+ PHP versions simultaneously
<?php function convertDate($tz, $dt) { if ($tz != "default") { date_default_timezone_set($tz); $new_dt = new DateTime($dt, new DateTimeZone($tz)); return $new_dt->format("d-m-Y H:i:s"); } else { return $dt; } } var_dump(convertDate("America/New_York", "2016-11-31 23:59:58")); var_dump(convertDate("Europe/London", "2016-11-31 23:59:58")); var_dump(convertDate("default", "2016-11-31 23:59:58"));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5CNQJ
function name:  (null)
number of ops:  22
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'convertdate'
          2        SEND_VAL                                                 'America%2FNew_York'
          3        SEND_VAL                                                 '2016-11-31+23%3A59%3A58'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
   14     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'convertdate'
          9        SEND_VAL                                                 'Europe%2FLondon'
         10        SEND_VAL                                                 '2016-11-31+23%3A59%3A58'
         11        DO_FCALL                                      0  $2      
         12        SEND_VAR                                                 $2
         13        DO_ICALL                                                 
   15    14        INIT_FCALL                                               'var_dump'
         15        INIT_FCALL                                               'convertdate'
         16        SEND_VAL                                                 'default'
         17        SEND_VAL                                                 '2016-11-31+23%3A59%3A58'
         18        DO_FCALL                                      0  $4      
         19        SEND_VAR                                                 $4
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Function convertdate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5CNQJ
function name:  convertDate
number of ops:  22
compiled vars:  !0 = $tz, !1 = $dt, !2 = $new_dt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        IS_NOT_EQUAL                                             !0, 'default'
          3      > JMPZ                                                     ~3, ->20
    5     4    >   INIT_FCALL                                               'date_default_timezone_set'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
    6     7        NEW                                              $5      'DateTime'
          8        SEND_VAR_EX                                              !1
          9        NEW                                              $6      'DateTimeZone'
         10        SEND_VAR_EX                                              !0
         11        DO_FCALL                                      0          
         12        SEND_VAR_NO_REF_EX                                       $6
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !2, $5
    7    15        INIT_METHOD_CALL                                         !2, 'format'
         16        SEND_VAL_EX                                              'd-m-Y+H%3Ai%3As'
         17        DO_FCALL                                      0  $10     
         18      > RETURN                                                   $10
         19*       JMP                                                      ->21
    9    20    > > RETURN                                                   !1
   11    21*     > RETURN                                                   null

End of function convertdate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.82 ms | 948 KiB | 21 Q