3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php print_r(verifyDate('1.1.2011')); 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); } }
based on QmCpR
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/GTQXH
function name:  (null)
number of ops:  32
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                                              '1.1.2011'
         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                                                 
  11    27        NOP                                                      
  16    28        NOP                                                      
  21    29        NOP                                                      
  26    30        NOP                                                      
  31    31      > RETURN                                                   1

Function getmonth:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/GTQXH
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
Jump found. Position 1 = -2
filename:       /in/GTQXH
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
Jump found. Position 1 = -2
filename:       /in/GTQXH
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_EX                                              'm%2Fd%2FY'
         3        SEND_VAR_EX                                              !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
Jump found. Position 1 = 3, Position 2 = 11
Branch analysis from position: 3
Jump found. Position 1 = -2
Branch analysis from position: 11
Jump found. Position 1 = -2
filename:       /in/GTQXH
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      :-5
         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 7.3.0