3v4l.org

run code in 300+ PHP versions simultaneously
<?php function testDateFormat($input) { $date = DateTime::createFromFormat('Y-m-d', $input); if($date) { return $date->format("Y-m-d"); } else { return "Invalid format"; } } echo testDateFormat("2014-5-5") . "\n"; echo testDateFormat("2014-5") . "\n"; echo testDateFormat("2014") . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eJfFU
function name:  (null)
number of ops:  16
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'testdateformat'
          1        SEND_VAL                                                 '2014-5-5'
          2        DO_FCALL                                      0  $0      
          3        CONCAT                                           ~1      $0, '%0A'
          4        ECHO                                                     ~1
   12     5        INIT_FCALL                                               'testdateformat'
          6        SEND_VAL                                                 '2014-5'
          7        DO_FCALL                                      0  $2      
          8        CONCAT                                           ~3      $2, '%0A'
          9        ECHO                                                     ~3
   13    10        INIT_FCALL                                               'testdateformat'
         11        SEND_VAL                                                 '2014'
         12        DO_FCALL                                      0  $4      
         13        CONCAT                                           ~5      $4, '%0A'
         14        ECHO                                                     ~5
         15      > RETURN                                                   1

Function testdateformat:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eJfFU
function name:  testDateFormat
number of ops:  14
compiled vars:  !0 = $input, !1 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          2        SEND_VAL                                                 'Y-m-d'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        ASSIGN                                                   !1, $2
    4     6      > JMPZ                                                     !1, ->12
    5     7    >   INIT_METHOD_CALL                                         !1, 'format'
          8        SEND_VAL_EX                                              'Y-m-d'
          9        DO_FCALL                                      0  $4      
         10      > RETURN                                                   $4
         11*       JMP                                                      ->13
    7    12    > > RETURN                                                   'Invalid+format'
    9    13*     > RETURN                                                   null

End of function testdateformat

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.91 ms | 1399 KiB | 16 Q