3v4l.org

run code in 300+ PHP versions simultaneously
<?php function validaData($date, $format = 'Y-m-d H:i:s') { $v_date = date_create_from_format($format, $date); $v_date = date_format($v_date, $format); echo $v_date; return ($v_date && $v_date == $date); } var_dump(validaData('2014-2-28', 'Y-m-d')); # true
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u7Jkp
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'validadata'
          2        SEND_VAL                                                 '2014-2-28'
          3        SEND_VAL                                                 'Y-m-d'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function validadata:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/u7Jkp
function name:  validaData
number of ops:  18
compiled vars:  !0 = $date, !1 = $format, !2 = $v_date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      'Y-m-d+H%3Ai%3As'
    4     2        INIT_FCALL                                               'date_create_from_format'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !2, $3
    5     7        INIT_FCALL                                               'date_format'
          8        SEND_VAR                                                 !2
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $5      
         11        ASSIGN                                                   !2, $5
    6    12        ECHO                                                     !2
    7    13      > JMPZ_EX                                          ~7      !2, ->16
         14    >   IS_EQUAL                                         ~8      !2, !0
         15        BOOL                                             ~7      ~8
         16    > > RETURN                                                   ~7
    8    17*     > RETURN                                                   null

End of function validadata

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.21 ms | 1399 KiB | 20 Q