3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dateofbirth = '2000-02-31'; $date = new DateTime($dateofbirth); $date_errors = DateTime::getLastErrors(); if ($date_errors['warning_count'] + $date_errors['error_count'] > 0) { echo 'Date '.$dateofbirth.' is not a valid DD/MM/YYYY format.'; } else { echo $date->format('Y-m-d'); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LPdIY
function name:  (null)
number of ops:  22
compiled vars:  !0 = $dateofbirth, !1 = $date, !2 = $date_errors
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '2000-02-31'
    3     1        NEW                                              $4      'DateTime'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $4
    5     5        INIT_STATIC_METHOD_CALL                                  'DateTime', 'getLastErrors'
          6        DO_FCALL                                      0  $7      
          7        ASSIGN                                                   !2, $7
    6     8        FETCH_DIM_R                                      ~9      !2, 'warning_count'
          9        FETCH_DIM_R                                      ~10     !2, 'error_count'
         10        ADD                                              ~11     ~9, ~10
         11        IS_SMALLER                                               0, ~11
         12      > JMPZ                                                     ~12, ->17
    7    13    >   CONCAT                                           ~13     'Date+', !0
         14        CONCAT                                           ~14     ~13, '+is+not+a+valid+DD%2FMM%2FYYYY+format.'
         15        ECHO                                                     ~14
         16      > JMP                                                      ->21
   10    17    >   INIT_METHOD_CALL                                         !1, 'format'
         18        SEND_VAL_EX                                              'Y-m-d'
         19        DO_FCALL                                      0  $15     
         20        ECHO                                                     $15
   11    21    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.95 ms | 1394 KiB | 13 Q