3v4l.org

run code in 300+ PHP versions simultaneously
<?PHP function mysql_date($in) { //Function takes a string in as form data, splits it by a list of //possible separators. If the resulting array has a length of 3, the //function returns a MySQL compatible date() string, else returns false // //Also, uses the checkdate() [PHP core function] to validate the date. $output = false; $d = preg_split('#[-/:. ]#', trim($in)); if (is_array($d) && count($d) == 3) { if (strlen($d[2]) == 2) { $d[2] = '20'.$d[2]; } if (checkdate($d[0], $d[1], $d[2])) { $output = "$d[2]-$d[0]-$d[1]"; } } return $output; } echo mysql_date('05/07/2014');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U3OA4
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'mysql_date'
          1        SEND_VAL                                                 '05%2F07%2F2014'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function mysql_date:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 42
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 42
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
Branch analysis from position: 24
Branch analysis from position: 42
Branch analysis from position: 15
filename:       /in/U3OA4
function name:  mysql_date
number of ops:  44
compiled vars:  !0 = $in, !1 = $output, !2 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    8     1        ASSIGN                                                   !1, <false>
    9     2        INIT_FCALL                                               'preg_split'
          3        SEND_VAL                                                 '%23%5B-%2F%3A.+%5D%23'
          4        INIT_FCALL                                               'trim'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                         $5      
          9        ASSIGN                                                   !2, $5
   10    10        TYPE_CHECK                                  128  ~7      !2
         11      > JMPZ_EX                                          ~7      ~7, ->15
         12    >   COUNT                                            ~8      !2
         13        IS_EQUAL                                         ~9      ~8, 3
         14        BOOL                                             ~7      ~9
         15    > > JMPZ                                                     ~7, ->42
   11    16    >   FETCH_DIM_R                                      ~10     !2, 2
         17        STRLEN                                           ~11     ~10
         18        IS_EQUAL                                                 ~11, 2
         19      > JMPZ                                                     ~12, ->24
   12    20    >   FETCH_DIM_R                                      ~14     !2, 2
         21        CONCAT                                           ~15     '20', ~14
         22        ASSIGN_DIM                                               !2, 2
         23        OP_DATA                                                  ~15
   14    24    >   INIT_FCALL                                               'checkdate'
         25        FETCH_DIM_R                                      ~16     !2, 0
         26        SEND_VAL                                                 ~16
         27        FETCH_DIM_R                                      ~17     !2, 1
         28        SEND_VAL                                                 ~17
         29        FETCH_DIM_R                                      ~18     !2, 2
         30        SEND_VAL                                                 ~18
         31        DO_ICALL                                         $19     
         32      > JMPZ                                                     $19, ->42
   15    33    >   FETCH_DIM_R                                      ~20     !2, 2
         34        ROPE_INIT                                     5  ~24     ~20
         35        ROPE_ADD                                      1  ~24     ~24, '-'
         36        FETCH_DIM_R                                      ~21     !2, 0
         37        ROPE_ADD                                      2  ~24     ~24, ~21
         38        ROPE_ADD                                      3  ~24     ~24, '-'
         39        FETCH_DIM_R                                      ~22     !2, 1
         40        ROPE_END                                      4  ~23     ~24, ~22
         41        ASSIGN                                                   !1, ~23
   18    42    > > RETURN                                                   !1
   19    43*     > RETURN                                                   null

End of function mysql_date

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.47 ms | 1403 KiB | 20 Q