3v4l.org

run code in 300+ PHP versions simultaneously
<?php $format = 'Y-m-d'; $value = '14-09-13'; $hasTimeInfo = (strpbrk($format, 'HhGgis') !== false); $date = DateTime::createFromFormat($format, $value, new DateTimeZone($hasTimeInfo ? 'Asia/Jakarta' : 'UTC')); $errors = DateTime::getLastErrors(); if ($date === false || $errors['error_count'] || $errors['warning_count']) { echo 'return false'; print_r($error); return; } if (!$hasTimeInfo) { $date->setTime(0, 0, 0); } echo $date->getTimestamp();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 47) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
2 jumps found. (Code = 47) Position 1 = 29, Position 2 = 31
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 37
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 44
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
Branch analysis from position: 31
Branch analysis from position: 28
Branch analysis from position: 15
2 jumps found. (Code = 47) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
Branch analysis from position: 28
filename:       /in/qLMTg
function name:  (null)
number of ops:  48
compiled vars:  !0 = $format, !1 = $value, !2 = $hasTimeInfo, !3 = $date, !4 = $errors, !5 = $error
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'Y-m-d'
    3     1        ASSIGN                                                   !1, '14-09-13'
    5     2        INIT_FCALL                                               'strpbrk'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'HhGgis'
          5        DO_ICALL                                         $8      
          6        TYPE_CHECK                                  1018  ~9      $8
          7        ASSIGN                                                   !2, ~9
    6     8        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !1
         11        NEW                                              $11     'DateTimeZone'
         12      > JMPZ                                                     !2, ->15
         13    >   QM_ASSIGN                                        ~12     'Asia%2FJakarta'
         14      > JMP                                                      ->16
         15    >   QM_ASSIGN                                        ~12     'UTC'
         16    >   SEND_VAL_EX                                              ~12
         17        DO_FCALL                                      0          
         18        SEND_VAR                                                 $11
         19        DO_FCALL                                      0  $14     
         20        ASSIGN                                                   !3, $14
    7    21        INIT_STATIC_METHOD_CALL                                  'DateTime', 'getLastErrors'
         22        DO_FCALL                                      0  $16     
         23        ASSIGN                                                   !4, $16
    8    24        TYPE_CHECK                                    4  ~18     !3
         25      > JMPNZ_EX                                         ~18     ~18, ->28
         26    >   FETCH_DIM_R                                      ~19     !4, 'error_count'
         27        BOOL                                             ~18     ~19
         28    > > JMPNZ_EX                                         ~18     ~18, ->31
         29    >   FETCH_DIM_R                                      ~20     !4, 'warning_count'
         30        BOOL                                             ~18     ~20
         31    > > JMPZ                                                     ~18, ->37
    9    32    >   ECHO                                                     'return+false'
   10    33        INIT_FCALL                                               'print_r'
         34        SEND_VAR                                                 !5
         35        DO_ICALL                                                 
   11    36      > RETURN                                                   null
   14    37    >   BOOL_NOT                                         ~22     !2
         38      > JMPZ                                                     ~22, ->44
   15    39    >   INIT_METHOD_CALL                                         !3, 'setTime'
         40        SEND_VAL_EX                                              0
         41        SEND_VAL_EX                                              0
         42        SEND_VAL_EX                                              0
         43        DO_FCALL                                      0          
   17    44    >   INIT_METHOD_CALL                                         !3, 'getTimestamp'
         45        DO_FCALL                                      0  $24     
         46        ECHO                                                     $24
         47      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.51 ms | 1443 KiB | 15 Q