3v4l.org

run code in 300+ PHP versions simultaneously
<?php 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 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/36jZc
function name:  (null)
number of ops:  21
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_FCALL_BY_NAME                                       'getMonth'
          2        SEND_VAL_EX                                              null
          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                                       'getQuarter'
          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                                       'dtf'
         16        SEND_VAL_EX                                              '+'
         17        DO_FCALL                                      0  $4      
         18        SEND_VAR                                                 $4
         19        DO_ICALL                                                 
   24    20      > RETURN                                                   1

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

End of function getquarter

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/36jZc
function name:  dtf
number of ops:  12
compiled vars:  !0 = $date, !1 = $format
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      'd.m.Y'
   20     2      > JMPZ                                                     !0, ->11
   21     3    >   NEW                                              $2      'DateTime'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $2
   22     7        INIT_METHOD_CALL                                         !0, 'format'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0  $5      
         10      > RETURN                                                   $5
   24    11    > > RETURN                                                   null

End of function dtf

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.41 ms | 1403 KiB | 18 Q