3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $dateTimeExample = new DateTime('2009-01-05'); $dateTimes = [ $dateTimeExample->format('Y-m-d H:i:s'), $dateTimeExample->format('c'), $dateTimeExample->format('Y-m-d') ]; foreach($dateTimes as $datetime){ preg_match('~(?<date>\d{4}-\d{2}-\d{2})[\s|T](?<time>\d{2}:\d{2}:\d{2})?(?<timezone>[\+|-]\d{2}:\d{2})?~', $dateTime, $matches); $matches['time'] = array_key_exists('time', $matches) ? $matches['time'] : '00:00:00'; var_dump($matches); } //$dateTime = sprintf('%s %s %s', $matches['date'], $matches['time'], $matches['datetime']); //$bla = \DateTime::createFromFormat('Y-m-d H:i:s', $dateTime); //var_dump($bla);
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 77) Position 1 = 18, Position 2 = 39
Branch analysis from position: 18
Jump found. (Code = 78) Position 1 = 19, Position 2 = 39
Branch analysis from position: 19
Jump found. (Code = 43) Position 1 = 29, Position 2 = 32
Branch analysis from position: 29
Jump found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
Jump found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 32
Jump found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 39
Jump found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
filename:       /in/7WYvv
function name:  (null)
number of ops:  41
compiled vars:  !0 = $dateTimeExample, !1 = $dateTimes, !2 = $datetime, !3 = $dateTime, !4 = $matches
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NEW                                              $5      :-5
         1        SEND_VAL_EX                                              '2009-01-05'
         2        DO_FCALL                                      0          
         3        ASSIGN                                                   !0, $5
   6     4        INIT_METHOD_CALL                                         !0, 'format'
         5        SEND_VAL_EX                                              'Y-m-d+H%3Ai%3As'
         6        DO_FCALL                                      0  $8      
         7        INIT_ARRAY                                       ~9      $8
   7     8        INIT_METHOD_CALL                                         !0, 'format'
         9        SEND_VAL_EX                                              'c'
        10        DO_FCALL                                      0  $10     
        11        ADD_ARRAY_ELEMENT                                ~9      $10
   8    12        INIT_METHOD_CALL                                         !0, 'format'
        13        SEND_VAL_EX                                              'Y-m-d'
        14        DO_FCALL                                      0  $11     
        15        ADD_ARRAY_ELEMENT                                ~9      $11
        16        ASSIGN                                                   !1, ~9
  11    17      > FE_RESET_R                                       $13     !1, ->39
        18    > > FE_FETCH_R                                               $13, !2, ->39
  12    19    >   INIT_FCALL                                               'preg_match'
        20        SEND_VAL                                                 '%7E%28%3F%3Cdate%3E%5Cd%7B4%7D-%5Cd%7B2%7D-%5Cd%7B2%7D%29%5B%5Cs%7CT%5D%28%3F%3Ctime%3E%5Cd%7B2%7D%3A%5Cd%7B2%7D%3A%5Cd%7B2%7D%29%3F%28%3F%3Ctimezone%3E%5B%5C%2B%7C-%5D%5Cd%7B2%7D%3A%5Cd%7B2%7D%29%3F%7E'
        21        SEND_VAR                                                 !3
        22        SEND_REF                                                 !4
        23        DO_ICALL                                                 
  13    24        INIT_FCALL                                               'array_key_exists'
        25        SEND_VAL                                                 'time'
        26        SEND_VAR                                                 !4
        27        DO_ICALL                                         $16     
        28      > JMPZ                                                     $16, ->32
        29    >   FETCH_DIM_R                                      $17     !4, 'time'
        30        QM_ASSIGN                                        ~18     $17
        31      > JMP                                                      ->33
        32    >   QM_ASSIGN                                        ~18     '00%3A00%3A00'
        33    >   ASSIGN_DIM                                               !4, 'time'
        34        OP_DATA                                                  ~18
  14    35        INIT_FCALL                                               'var_dump'
        36        SEND_VAR                                                 !4
        37        DO_ICALL                                                 
        38      > JMP                                                      ->18
        39    >   FE_FREE                                                  $13
  20    40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.3.0