3v4l.org

run code in 300+ PHP versions simultaneously
<?php function format_date_input($value) { if (strpos($value, '/') != false) { // Delimiter is '/' - jQuery datepicker in use list($day, $month, $year) = explode('/', $value); } else if (strpos($value, '-') != false) { // Delimiter is '-' - HTML5 datepicker in use list($year, $month, $day) = explode('-', $value); } else return ''; $usdate = $month.'/'.$day.'/'.$year; $timestamp = strtotime($usdate); if ($timestamp == false) return ''; else return date($format, $timestamp); } format_date_input('2014-01-10'); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jsPX6
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'format_date_input'
          1        SEND_VAL                                                 '2014-01-10'
          2        DO_FCALL                                      0          
   16     3      > RETURN                                                   1

Function format_date_input:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 19
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 51
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 37
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jsPX6
function name:  format_date_input
number of ops:  57
compiled vars:  !0 = $value, !1 = $day, !2 = $month, !3 = $year, !4 = $usdate, !5 = $timestamp, !6 = $format
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   RECV                                             !0      
    2     1        INIT_FCALL                                               'strpos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%2F'
          4        DO_ICALL                                         $7      
          5        BOOL                                             ~8      $7
          6      > JMPZ                                                     ~8, ->19
    3     7    >   INIT_FCALL                                               'explode'
          8        SEND_VAL                                                 '%2F'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $9      
         11        FETCH_LIST_R                                     $10     $9, 0
         12        ASSIGN                                                   !1, $10
         13        FETCH_LIST_R                                     $12     $9, 1
         14        ASSIGN                                                   !2, $12
         15        FETCH_LIST_R                                     $14     $9, 2
         16        ASSIGN                                                   !3, $14
         17        FREE                                                     $9
         18      > JMP                                                      ->38
    4    19    >   INIT_FCALL                                               'strpos'
         20        SEND_VAR                                                 !0
         21        SEND_VAL                                                 '-'
         22        DO_ICALL                                         $16     
         23        BOOL                                             ~17     $16
         24      > JMPZ                                                     ~17, ->37
    5    25    >   INIT_FCALL                                               'explode'
         26        SEND_VAL                                                 '-'
         27        SEND_VAR                                                 !0
         28        DO_ICALL                                         $18     
         29        FETCH_LIST_R                                     $19     $18, 0
         30        ASSIGN                                                   !3, $19
         31        FETCH_LIST_R                                     $21     $18, 1
         32        ASSIGN                                                   !2, $21
         33        FETCH_LIST_R                                     $23     $18, 2
         34        ASSIGN                                                   !1, $23
         35        FREE                                                     $18
         36      > JMP                                                      ->38
    6    37    > > RETURN                                                   ''
    8    38    >   CONCAT                                           ~25     !2, '%2F'
         39        CONCAT                                           ~26     ~25, !1
         40        CONCAT                                           ~27     ~26, '%2F'
         41        CONCAT                                           ~28     ~27, !3
         42        ASSIGN                                                   !4, ~28
    9    43        INIT_FCALL                                               'strtotime'
         44        SEND_VAR                                                 !4
         45        DO_ICALL                                         $30     
         46        ASSIGN                                                   !5, $30
   11    47        BOOL_NOT                                         ~32     !5
         48      > JMPZ                                                     ~32, ->51
         49    > > RETURN                                                   ''
         50*       JMP                                                      ->56
   12    51    >   INIT_FCALL                                               'date'
         52        SEND_VAR                                                 !6
         53        SEND_VAR                                                 !5
         54        DO_ICALL                                         $33     
         55      > RETURN                                                   $33
   13    56*     > RETURN                                                   null

End of function format_date_input

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.19 ms | 1402 KiB | 22 Q