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); } for($m=1; $m <= 12; $m++) { var_dump(getQuarterEndingOf($m)); $d = new \DateTime(); var_dump($d->setDate(date('Y'), ceil($m/3)*3,1)); echo '==='; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 2
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 2
Branch analysis from position: 31
Branch analysis from position: 2
filename:       /in/IppIE
function name:  (null)
number of ops:  32
compiled vars:  !0 = $m, !1 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ASSIGN                                                   !0, 1
          1      > JMP                                                      ->29
   22     2    >   INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'getquarterendingof'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                                 
   23     8        NEW                                              $5      'DateTime'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $5
   24    11        INIT_FCALL                                               'var_dump'
         12        INIT_METHOD_CALL                                         !1, 'setDate'
         13        INIT_FCALL                                               'date'
         14        SEND_VAL                                                 'Y'
         15        DO_ICALL                                         $8      
         16        SEND_VAR_NO_REF_EX                                       $8
         17        INIT_FCALL                                               'ceil'
         18        DIV                                              ~9      !0, 3
         19        SEND_VAL                                                 ~9
         20        DO_ICALL                                         $10     
         21        MUL                                              ~11     $10, 3
         22        SEND_VAL_EX                                              ~11
         23        SEND_VAL_EX                                              1
         24        DO_FCALL                                      0  $12     
         25        SEND_VAR                                                 $12
         26        DO_ICALL                                                 
   25    27        ECHO                                                     '%3D%3D%3D'
   20    28        PRE_INC                                                  !0
         29    >   IS_SMALLER_OR_EQUAL                                      !0, 12
         30      > JMPNZ                                                    ~15, ->2
   26    31    > > RETURN                                                   1

Function getquarterendingof:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IppIE
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.62 ms | 1403 KiB | 22 Q