3v4l.org

run code in 300+ PHP versions simultaneously
<?php function validateDate($date, $format = 'Y-m-d') { $d = DateTime::createFromFormat($format, $date); return $d && $d->format($format) == $date; } var_dump(validateDate('08/01/2014', 'm/d/YYYY'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r1cAd
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'validatedate'
          2        SEND_VAL                                                 '08%2F01%2F2014'
          3        SEND_VAL                                                 'm%2Fd%2FYYYY'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function validatedate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/r1cAd
function name:  validateDate
number of ops:  15
compiled vars:  !0 = $date, !1 = $format, !2 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      'Y-m-d'
    4     2        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $3      
          6        ASSIGN                                                   !2, $3
    5     7      > JMPZ_EX                                          ~5      !2, ->13
          8    >   INIT_METHOD_CALL                                         !2, 'format'
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0  $6      
         11        IS_EQUAL                                         ~7      !0, $6
         12        BOOL                                             ~5      ~7
         13    > > RETURN                                                   ~5
    6    14*     > RETURN                                                   null

End of function validatedate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.99 ms | 1398 KiB | 16 Q