3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sourceFormat = 'd-m-Y'; $targetFormat = 'Y-m-d'; $value = '22-11-2017'; $datetime = \DateTime::createFromFormat($sourceFormat, $value); $output = $datetime != false ? date($targetFormat, $datetime->getTimestamp()) : $defaultValue; var_dump($output);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hJ26L
function name:  (null)
number of ops:  24
compiled vars:  !0 = $sourceFormat, !1 = $targetFormat, !2 = $value, !3 = $datetime, !4 = $output, !5 = $defaultValue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'd-m-Y'
    4     1        ASSIGN                                                   !1, 'Y-m-d'
    6     2        ASSIGN                                                   !2, '22-11-2017'
    8     3        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !2
          6        DO_FCALL                                      0  $9      
          7        ASSIGN                                                   !3, $9
    9     8        BOOL                                             ~11     !3
          9      > JMPZ                                                     ~11, ->18
         10    >   INIT_FCALL                                               'date'
         11        SEND_VAR                                                 !1
         12        INIT_METHOD_CALL                                         !3, 'getTimestamp'
         13        DO_FCALL                                      0  $12     
         14        SEND_VAR                                                 $12
         15        DO_ICALL                                         $13     
         16        QM_ASSIGN                                        ~14     $13
         17      > JMP                                                      ->19
         18    >   QM_ASSIGN                                        ~14     !5
         19    >   ASSIGN                                                   !4, ~14
   11    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !4
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.31 ms | 1427 KiB | 15 Q