3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getQuarterEndingOf($month) { $quarterEndings = [ 1 => 'Mar', 2 => 'Mar', 3 => 'Mar', 4 => 'Jun', 5 => 'Jun', 6 => 'Jun', 7 => 'Sep', 8 => 'Sep', 9 => 'Sep', 10 => 'Dec', 11 => 'Dec', 12 => 'Dec', ]; $timeFormat = sprintf('%s %s', $quarterEndings[$month], date('Y') ); return new \DateTime($timeFormat); } var_dump(getQuarterEndingOf(11)); $d = new \DateTime(); var_dump($d->setDate(date('Y'), floor(date('m')/3),date('d')));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jkg6j
function name:  (null)
number of ops:  31
compiled vars:  !0 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'getquarterendingof'
          2        SEND_VAL                                                 11
          3        DO_FCALL                                      0  $1      
          4        SEND_VAR                                                 $1
          5        DO_ICALL                                                 
   21     6        NEW                                              $3      'DateTime'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !0, $3
   22     9        INIT_FCALL                                               'var_dump'
         10        INIT_METHOD_CALL                                         !0, 'setDate'
         11        INIT_FCALL                                               'date'
         12        SEND_VAL                                                 'Y'
         13        DO_ICALL                                         $6      
         14        SEND_VAR_NO_REF_EX                                       $6
         15        INIT_FCALL                                               'floor'
         16        INIT_FCALL                                               'date'
         17        SEND_VAL                                                 'm'
         18        DO_ICALL                                         $7      
         19        DIV                                              ~8      $7, 3
         20        SEND_VAL                                                 ~8
         21        DO_ICALL                                         $9      
         22        SEND_VAR_NO_REF_EX                                       $9
         23        INIT_FCALL                                               'date'
         24        SEND_VAL                                                 'd'
         25        DO_ICALL                                         $10     
         26        SEND_VAR_NO_REF_EX                                       $10
         27        DO_FCALL                                      0  $11     
         28        SEND_VAR                                                 $11
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Function getquarterendingof:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jkg6j
function name:  getQuarterEndingOf
number of ops:  17
compiled vars:  !0 = $month, !1 = $quarterEndings, !2 = $timeFormat
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, <array>
   12     2        INIT_FCALL                                               'sprintf'
          3        SEND_VAL                                                 '%25s+%25s'
   13     4        FETCH_DIM_R                                      ~4      !1, !0
          5        SEND_VAL                                                 ~4
   14     6        INIT_FCALL                                               'date'
          7        SEND_VAL                                                 'Y'
          8        DO_ICALL                                         $5      
          9        SEND_VAR                                                 $5
         10        DO_ICALL                                         $6      
   12    11        ASSIGN                                                   !2, $6
   17    12        NEW                                              $8      'DateTime'
         13        SEND_VAR_EX                                              !2
         14        DO_FCALL                                      0          
         15      > RETURN                                                   $8
   18    16*     > RETURN                                                   null

End of function getquarterendingof

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.14 ms | 1402 KiB | 22 Q