3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyDateTime extends DateTime { public static function createFromFormat($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)){ return parent::createFromFormat($format, $time, $timezone); } return new DateTime(date($format, strtotime($time)), $timezone); } } $dateTime = MyDateTime::createFromFormat('Y-m-d', '2013-6-13'); var_dump($dateTime); var_dump($dateTime->format('Y-m-d'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YWRRW
function name:  (null)
number of ops:  15
compiled vars:  !0 = $dateTime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_STATIC_METHOD_CALL                                  'MyDateTime', 'createFromFormat'
          1        SEND_VAL                                                 'Y-m-d'
          2        SEND_VAL                                                 '2013-6-13'
          3        DO_FCALL                                      0  $1      
          4        ASSIGN                                                   !0, $1
   16     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
   17     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !0, 'format'
         10        SEND_VAL_EX                                              'Y-m-d'
         11        DO_FCALL                                      0  $4      
         12        SEND_VAR                                                 $4
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

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

End of function createfromformat

End of class MyDateTime.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.24 ms | 1464 KiB | 19 Q