3v4l.org

run code in 300+ PHP versions simultaneously
<?php $result=FALSE; $date ="1923-56-56"; $pattern = '/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/'; preg_match($pattern, $date, $matches); if (is_array($matches) AND count($matches) >=1) { print "Valid Date"; }else{ print "Not Valid Date"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/bSNmL
function name:  (null)
number of ops:  18
compiled vars:  !0 = $result, !1 = $date, !2 = $pattern, !3 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <false>
    3     1        ASSIGN                                                   !1, '1923-56-56'
    4     2        ASSIGN                                                   !2, '%2F%5E%5B0-9%5D%7B4%7D-%5B0-9%5D%7B2%7D-%5B0-9%5D%7B2%7D%24%2F'
    5     3        INIT_FCALL                                               'preg_match'
          4        SEND_VAR                                                 !2
          5        SEND_VAR                                                 !1
          6        SEND_REF                                                 !3
          7        DO_ICALL                                                 
    6     8        TYPE_CHECK                                  128  ~8      !3
          9      > JMPZ_EX                                          ~8      ~8, ->13
         10    >   COUNT                                            ~9      !3
         11        IS_SMALLER_OR_EQUAL                              ~10     1, ~9
         12        BOOL                                             ~8      ~10
         13    > > JMPZ                                                     ~8, ->16
    7    14    >   ECHO                                                     'Valid+Date'
         15      > JMP                                                      ->17
    9    16    >   ECHO                                                     'Not+Valid+Date'
   10    17    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.03 ms | 1395 KiB | 15 Q