3v4l.org

run code in 300+ PHP versions simultaneously
<?php print_r(verifyDate(' ')); echo ':::'; print_r(getMonth(null)); echo ':::'; print_r(getQuarter(null)); echo ':::'; print_r(dtf(' ')); function getMonth($d) { return dtf($d,'n'); } function getQuarter($d) { return ceil( getMonth($d) / 3); } function verifyDate($date) { return DateTime::createFromFormat('m/d/Y', $date); } function dtf($date, $format = 'd.m.Y'){ if($date){ $date = new DateTime($date); return $date->format($format); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QmCpR
function name:  (null)
number of ops:  28
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_FCALL_BY_NAME                                       'verifyDate'
          2        SEND_VAL_EX                                              '+'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
    4     6        ECHO                                                     '%3A%3A%3A'
    5     7        INIT_FCALL                                               'print_r'
          8        INIT_FCALL_BY_NAME                                       'getMonth'
          9        SEND_VAL_EX                                              null
         10        DO_FCALL                                      0  $2      
         11        SEND_VAR                                                 $2
         12        DO_ICALL                                                 
    6    13        ECHO                                                     '%3A%3A%3A'
    7    14        INIT_FCALL                                               'print_r'
         15        INIT_FCALL_BY_NAME                                       'getQuarter'
         16        SEND_VAL_EX                                              null
         17        DO_FCALL                                      0  $4      
         18        SEND_VAR                                                 $4
         19        DO_ICALL                                                 
    8    20        ECHO                                                     '%3A%3A%3A'
    9    21        INIT_FCALL                                               'print_r'
         22        INIT_FCALL_BY_NAME                                       'dtf'
         23        SEND_VAL_EX                                              '+'
         24        DO_FCALL                                      0  $6      
         25        SEND_VAR                                                 $6
         26        DO_ICALL                                                 
   31    27      > RETURN                                                   1

Function getmonth:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QmCpR
function name:  getMonth
number of ops:  7
compiled vars:  !0 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   13     1        INIT_FCALL_BY_NAME                                       'dtf'
          2        SEND_VAR_EX                                              !0
          3        SEND_VAL_EX                                              'n'
          4        DO_FCALL                                      0  $1      
          5      > RETURN                                                   $1
   14     6*     > RETURN                                                   null

End of function getmonth

Function getquarter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QmCpR
function name:  getQuarter
number of ops:  10
compiled vars:  !0 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   18     1        INIT_FCALL                                               'ceil'
          2        INIT_FCALL                                               'getmonth'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $1      
          5        DIV                                              ~2      $1, 3
          6        SEND_VAL                                                 ~2
          7        DO_ICALL                                         $3      
          8      > RETURN                                                   $3
   19     9*     > RETURN                                                   null

End of function getquarter

Function verifydate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QmCpR
function name:  verifyDate
number of ops:  7
compiled vars:  !0 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   23     1        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          2        SEND_VAL                                                 'm%2Fd%2FY'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $1      
          5      > RETURN                                                   $1
   24     6*     > RETURN                                                   null

End of function verifydate

Function dtf:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 11
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QmCpR
function name:  dtf
number of ops:  12
compiled vars:  !0 = $date, !1 = $format
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      'd.m.Y'
   27     2      > JMPZ                                                     !0, ->11
   28     3    >   NEW                                              $2      'DateTime'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $2
   29     7        INIT_METHOD_CALL                                         !0, 'format'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0  $5      
         10      > RETURN                                                   $5
   31    11    > > RETURN                                                   null

End of function dtf

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.54 ms | 1403 KiB | 18 Q