3v4l.org

run code in 300+ PHP versions simultaneously
<?php function converteData($format, $to_format, $time, $timezone = null) { $version = explode('.', phpversion()); if (!$timezone) { $timezone = new DateTimeZone(date_default_timezone_get()); } if ((int)$version[0] >= 5 && (int)$version[1] >= 2 && (int)$version[2] > 17) { $datetime = DateTime::createFromFormat($format, $time, $timezone); } else { $datetime = new DateTime(date($format, strtotime($time)), $timezone); } return $datetime->format($to_format); } var_dump(converteData('d-m-y', 'd/m/Y H:i:s', '06-11-1992'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qf513
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'convertedata'
          2        SEND_VAL                                                 'd-m-y'
          3        SEND_VAL                                                 'd%2Fm%2FY+H%3Ai%3As'
          4        SEND_VAL                                                 '06-11-1992'
          5        DO_FCALL                                      0  $0      
          6        SEND_VAR                                                 $0
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function convertedata:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 19
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 23, Position 2 = 27
Branch analysis from position: 23
2 jumps found. (Code = 46) Position 1 = 28, Position 2 = 32
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 40
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
Branch analysis from position: 27
Branch analysis from position: 19
filename:       /in/qf513
function name:  converteData
number of ops:  57
compiled vars:  !0 = $format, !1 = $to_format, !2 = $time, !3 = $timezone, !4 = $version, !5 = $datetime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV_INIT                                        !3      null
    6     4        INIT_FCALL                                               'explode'
          5        SEND_VAL                                                 '.'
          6        INIT_FCALL                                               'phpversion'
          7        DO_ICALL                                         $6      
          8        SEND_VAR                                                 $6
          9        DO_ICALL                                         $7      
         10        ASSIGN                                                   !4, $7
    7    11        BOOL_NOT                                         ~9      !3
         12      > JMPZ                                                     ~9, ->19
    8    13    >   NEW                                              $10     'DateTimeZone'
         14        INIT_FCALL                                               'date_default_timezone_get'
         15        DO_ICALL                                         $11     
         16        SEND_VAR_NO_REF_EX                                       $11
         17        DO_FCALL                                      0          
         18        ASSIGN                                                   !3, $10
   10    19    >   FETCH_DIM_R                                      ~14     !4, 0
         20        CAST                                          4  ~15     ~14
         21        IS_SMALLER_OR_EQUAL                              ~16     5, ~15
         22      > JMPZ_EX                                          ~16     ~16, ->27
         23    >   FETCH_DIM_R                                      ~17     !4, 1
         24        CAST                                          4  ~18     ~17
         25        IS_SMALLER_OR_EQUAL                              ~19     2, ~18
         26        BOOL                                             ~16     ~19
         27    > > JMPZ_EX                                          ~16     ~16, ->32
         28    >   FETCH_DIM_R                                      ~20     !4, 2
         29        CAST                                          4  ~21     ~20
         30        IS_SMALLER                                       ~22     17, ~21
         31        BOOL                                             ~16     ~22
         32    > > JMPZ                                                     ~16, ->40
   11    33    >   INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
         34        SEND_VAR                                                 !0
         35        SEND_VAR                                                 !2
         36        SEND_VAR                                                 !3
         37        DO_FCALL                                      0  $23     
         38        ASSIGN                                                   !5, $23
         39      > JMP                                                      ->52
   13    40    >   NEW                                              $25     'DateTime'
         41        INIT_FCALL                                               'date'
         42        SEND_VAR                                                 !0
         43        INIT_FCALL                                               'strtotime'
         44        SEND_VAR                                                 !2
         45        DO_ICALL                                         $26     
         46        SEND_VAR                                                 $26
         47        DO_ICALL                                         $27     
         48        SEND_VAR_NO_REF_EX                                       $27
         49        SEND_VAR_EX                                              !3
         50        DO_FCALL                                      0          
         51        ASSIGN                                                   !5, $25
   15    52    >   INIT_METHOD_CALL                                         !5, 'format'
         53        SEND_VAR_EX                                              !1
         54        DO_FCALL                                      0  $30     
         55      > RETURN                                                   $30
   16    56*     > RETURN                                                   null

End of function convertedata

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.79 ms | 1402 KiB | 26 Q