3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = ['year' => 0, 'month' => 2, 'day' => '2']; $valid_date = FALSE; if (!empty($array['year']) && !empty($array['month']) && !empty($array['day'])) { $valid_date = checkdate($array['month'], $array['day'], $array['year']); } var_dump($valid_date); $valid_date = FALSE; if (array_key_exists('year', $array) && array_key_exists('month', $array) && array_key_exists('day', $array)) { if (@checkdate($array['month'], $array['day'], $array['year'])) { $valid_date = TRUE; } } var_dump($valid_date);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 22
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
2 jumps found. (Code = 46) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 46
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 45, Position 2 = 46
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
Branch analysis from position: 46
Branch analysis from position: 33
Branch analysis from position: 30
Branch analysis from position: 22
Branch analysis from position: 12
Branch analysis from position: 8
filename:       /in/HBXvM
function name:  (null)
number of ops:  50
compiled vars:  !0 = $array, !1 = $valid_date
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        ASSIGN                                                       !1, <false>
    5     2        ISSET_ISEMPTY_DIM_OBJ                             1  ~4      !0, 'year'
          3        BOOL_NOT                                             ~5      ~4
          4      > JMPZ_EX                                              ~5      ~5, ->8
          5    >   ISSET_ISEMPTY_DIM_OBJ                             1  ~6      !0, 'month'
          6        BOOL_NOT                                             ~7      ~6
          7        BOOL                                                 ~5      ~7
          8    > > JMPZ_EX                                              ~5      ~5, ->12
          9    >   ISSET_ISEMPTY_DIM_OBJ                             1  ~8      !0, 'day'
         10        BOOL_NOT                                             ~9      ~8
         11        BOOL                                                 ~5      ~9
         12    > > JMPZ                                                         ~5, ->22
    6    13    >   INIT_FCALL                                                   'checkdate'
         14        FETCH_DIM_R                                          ~10     !0, 'month'
         15        SEND_VAL                                                     ~10
         16        FETCH_DIM_R                                          ~11     !0, 'day'
         17        SEND_VAL                                                     ~11
         18        FETCH_DIM_R                                          ~12     !0, 'year'
         19        SEND_VAL                                                     ~12
         20        DO_ICALL                                             $13     
         21        ASSIGN                                                       !1, $13
    9    22    >   INIT_FCALL                                                   'var_dump'
         23        SEND_VAR                                                     !1
         24        DO_ICALL                                                     
   11    25        ASSIGN                                                       !1, <false>
   12    26        ARRAY_KEY_EXISTS                                     ~17     'year', !0
         27      > JMPZ_EX                                              ~17     ~17, ->30
         28    >   ARRAY_KEY_EXISTS                                     ~18     'month', !0
         29        BOOL                                                 ~17     ~18
         30    > > JMPZ_EX                                              ~17     ~17, ->33
         31    >   ARRAY_KEY_EXISTS                                     ~19     'day', !0
         32        BOOL                                                 ~17     ~19
         33    > > JMPZ                                                         ~17, ->46
   13    34    >   BEGIN_SILENCE                                        ~20     
         35        INIT_FCALL                                                   'checkdate'
         36        FETCH_DIM_R                                          ~21     !0, 'month'
         37        SEND_VAL                                                     ~21
         38        FETCH_DIM_R                                          ~22     !0, 'day'
         39        SEND_VAL                                                     ~22
         40        FETCH_DIM_R                                          ~23     !0, 'year'
         41        SEND_VAL                                                     ~23
         42        DO_ICALL                                             $24     
         43        END_SILENCE                                                  ~20
         44      > JMPZ                                                         $24, ->46
   14    45    >   ASSIGN                                                       !1, <true>
   17    46    >   INIT_FCALL                                                   'var_dump'
         47        SEND_VAR                                                     !1
         48        DO_ICALL                                                     
         49      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.31 ms | 2180 KiB | 15 Q