3v4l.org

run code in 300+ PHP versions simultaneously
<?php $invalid = '2019-03-32'; $invalid2 = '2019-03-30l'; $valid = '2019-03-30'; function is_date($date) { $splitefromdate = explode("-", $date); $fromyear = $splitefromdate[0]; $frommonth = $splitefromdate[1]; $fromdate = $splitefromdate[2]; return checkdate(is_numeric($frommonth), is_numeric($fromdate), is_numeric($fromyear)) && strtotime($date); } var_dump(is_date($invalid)); var_dump(is_date($invalid2)); var_dump(is_date($valid));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NgZtO
function name:  (null)
number of ops:  22
compiled vars:  !0 = $invalid, !1 = $invalid2, !2 = $valid
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '2019-03-32'
    4     1        ASSIGN                                                   !1, '2019-03-30l'
    5     2        ASSIGN                                                   !2, '2019-03-30'
   16     3        INIT_FCALL                                               'var_dump'
          4        INIT_FCALL                                               'is_date'
          5        SEND_VAR                                                 !0
          6        DO_FCALL                                      0  $6      
          7        SEND_VAR                                                 $6
          8        DO_ICALL                                                 
   17     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'is_date'
         11        SEND_VAR                                                 !1
         12        DO_FCALL                                      0  $8      
         13        SEND_VAR                                                 $8
         14        DO_ICALL                                                 
   18    15        INIT_FCALL                                               'var_dump'
         16        INIT_FCALL                                               'is_date'
         17        SEND_VAR                                                 !2
         18        DO_FCALL                                      0  $10     
         19        SEND_VAR                                                 $10
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Function is_date:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 27, Position 2 = 31
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/NgZtO
function name:  is_date
number of ops:  33
compiled vars:  !0 = $date, !1 = $splitefromdate, !2 = $fromyear, !3 = $frommonth, !4 = $fromdate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '-'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
    9     6        FETCH_DIM_R                                      ~7      !1, 0
          7        ASSIGN                                                   !2, ~7
   10     8        FETCH_DIM_R                                      ~9      !1, 1
          9        ASSIGN                                                   !3, ~9
   11    10        FETCH_DIM_R                                      ~11     !1, 2
         11        ASSIGN                                                   !4, ~11
   13    12        INIT_FCALL                                               'checkdate'
         13        INIT_FCALL                                               'is_numeric'
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $13     
         16        SEND_VAR                                                 $13
         17        INIT_FCALL                                               'is_numeric'
         18        SEND_VAR                                                 !4
         19        DO_ICALL                                         $14     
         20        SEND_VAR                                                 $14
         21        INIT_FCALL                                               'is_numeric'
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                         $15     
         24        SEND_VAR                                                 $15
         25        DO_ICALL                                         $16     
         26      > JMPZ_EX                                          ~17     $16, ->31
         27    >   INIT_FCALL                                               'strtotime'
         28        SEND_VAR                                                 !0
         29        DO_ICALL                                         $18     
         30        BOOL                                             ~17     $18
         31    > > RETURN                                                   ~17
   14    32*     > RETURN                                                   null

End of function is_date

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
275.21 ms | 1022 KiB | 21 Q