3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getFormattedDateTime($date, $timezone) { $datetime = DateTimeImmutable::createFromFormat( 'Y-m-d H:i:s', $date, new DateTimeZone( $timezone ) ); $rfc3339 = $datetime->format( DATE_RFC3339 ); var_dump($rfc3339); } $timezones = [ 'UTC', 'America/Regina', 'Europe/Kiev', ]; $date = '1970-01-01 00:00:00'; foreach ($timezones as $timezone) { getFormattedDateTime($date, $timezone); } $date = '2022-08-29 12:00:00'; foreach ($timezones as $timezone) { getFormattedDateTime($date, $timezone); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 18
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 18
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
Branch analysis from position: 9
filename:       /in/Hpe2R
function name:  (null)
number of ops:  20
compiled vars:  !0 = $timezones, !1 = $date, !2 = $timezone
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, <array>
   19     1        ASSIGN                                                   !1, '1970-01-01+00%3A00%3A00'
   20     2      > FE_RESET_R                                       $5      !0, ->9
          3    > > FE_FETCH_R                                               $5, !2, ->9
   21     4    >   INIT_FCALL                                               'getformatteddatetime'
          5        SEND_VAR                                                 !1
          6        SEND_VAR                                                 !2
          7        DO_FCALL                                      0          
   20     8      > JMP                                                      ->3
          9    >   FE_FREE                                                  $5
   24    10        ASSIGN                                                   !1, '2022-08-29+12%3A00%3A00'
   25    11      > FE_RESET_R                                       $8      !0, ->18
         12    > > FE_FETCH_R                                               $8, !2, ->18
   26    13    >   INIT_FCALL                                               'getformatteddatetime'
         14        SEND_VAR                                                 !1
         15        SEND_VAR                                                 !2
         16        DO_FCALL                                      0          
   25    17      > JMP                                                      ->12
         18    >   FE_FREE                                                  $8
   27    19      > RETURN                                                   1

Function getformatteddatetime:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Hpe2R
function name:  getFormattedDateTime
number of ops:  19
compiled vars:  !0 = $date, !1 = $timezone, !2 = $datetime, !3 = $rfc3339
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_STATIC_METHOD_CALL                                  'DateTimeImmutable', 'createFromFormat'
    5     3        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
    6     4        SEND_VAR                                                 !0
    7     5        NEW                                              $4      'DateTimeZone'
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0          
          8        SEND_VAR                                                 $4
    4     9        DO_FCALL                                      0  $6      
         10        ASSIGN                                                   !2, $6
    9    11        INIT_METHOD_CALL                                         !2, 'format'
         12        SEND_VAL_EX                                              'Y-m-d%5CTH%3Ai%3AsP'
         13        DO_FCALL                                      0  $8      
         14        ASSIGN                                                   !3, $8
   10    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                                 
   11    18      > RETURN                                                   null

End of function getformatteddatetime

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.37 ms | 1458 KiB | 16 Q