3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ConvertToMySQLDate($datestr) { $d = DateTime::createFromFormat('d/m/Y', $datestr); $valid = $d && $d->format('d/m/Y') == $datestr; if ($valid) { return $d->format('Y-m-d'); } return FALSE; } var_dump(ConvertToMySQLDate('28/03/2014'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GmeP6
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'converttomysqldate'
          2        SEND_VAL                                                 '28%2F03%2F2014'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function converttomysqldate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/GmeP6
function name:  ConvertToMySQLDate
number of ops:  20
compiled vars:  !0 = $datestr, !1 = $d, !2 = $valid
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          2        SEND_VAL                                                 'd%2Fm%2FY'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $3      
          5        ASSIGN                                                   !1, $3
    6     6      > JMPZ_EX                                          ~5      !1, ->12
          7    >   INIT_METHOD_CALL                                         !1, 'format'
          8        SEND_VAL_EX                                              'd%2Fm%2FY'
          9        DO_FCALL                                      0  $6      
         10        IS_EQUAL                                         ~7      !0, $6
         11        BOOL                                             ~5      ~7
         12    >   ASSIGN                                                   !2, ~5
    7    13      > JMPZ                                                     !2, ->18
    8    14    >   INIT_METHOD_CALL                                         !1, 'format'
         15        SEND_VAL_EX                                              'Y-m-d'
         16        DO_FCALL                                      0  $9      
         17      > RETURN                                                   $9
   10    18    > > RETURN                                                   <false>
   11    19*     > RETURN                                                   null

End of function converttomysqldate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.33 ms | 1399 KiB | 16 Q