3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getVictoriaDay($year = null) { if(!$year){ $year = (int)(new \DateTime())->format('Y'); } $victoriaDay = new \dateTime("$year-05-24"); if($victoriaDay->format('D') !== 'Mon'){ $victoriaDay->modify('previous monday'); } return $victoriaDay; } for($year = 1960; $year <= 2020; $year ++){ echo getVictoriaday($year)->format('D Y-m-d') . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 2
Branch analysis from position: 13
Branch analysis from position: 2
filename:       /in/GsblDt
function name:  (null)
number of ops:  14
compiled vars:  !0 = $year
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, 1960
          1      > JMP                                                      ->11
   15     2    >   INIT_FCALL                                               'getvictoriaday'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        INIT_METHOD_CALL                                         $2, 'format'
          6        SEND_VAL_EX                                              'D+Y-m-d'
          7        DO_FCALL                                      0  $3      
          8        CONCAT                                           ~4      $3, '%0A'
          9        ECHO                                                     ~4
   14    10        PRE_INC                                                  !0
         11    >   IS_SMALLER_OR_EQUAL                                      !0, 2020
         12      > JMPNZ                                                    ~6, ->2
   16    13    > > RETURN                                                   1

Function getvictoriaday:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
Branch analysis from position: 10
filename:       /in/GsblDt
function name:  getVictoriaDay
number of ops:  26
compiled vars:  !0 = $year, !1 = $victoriaDay
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV_INIT                                        !0      null
    4     1        BOOL_NOT                                         ~2      !0
          2      > JMPZ                                                     ~2, ->10
    5     3    >   NEW                                              $3      'DateTime'
          4        DO_FCALL                                      0          
          5        INIT_METHOD_CALL                                         $3, 'format'
          6        SEND_VAL_EX                                              'Y'
          7        DO_FCALL                                      0  $5      
          8        CAST                                          4  ~6      $5
          9        ASSIGN                                                   !0, ~6
    7    10    >   NEW                                              $8      'dateTime'
         11        NOP                                                      
         12        FAST_CONCAT                                      ~9      !0, '-05-24'
         13        SEND_VAL_EX                                              ~9
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !1, $8
    8    16        INIT_METHOD_CALL                                         !1, 'format'
         17        SEND_VAL_EX                                              'D'
         18        DO_FCALL                                      0  $12     
         19        IS_NOT_IDENTICAL                                         $12, 'Mon'
         20      > JMPZ                                                     ~13, ->24
    9    21    >   INIT_METHOD_CALL                                         !1, 'modify'
         22        SEND_VAL_EX                                              'previous+monday'
         23        DO_FCALL                                      0          
   11    24    > > RETURN                                                   !1
   12    25*     > RETURN                                                   null

End of function getvictoriaday

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
268.96 ms | 1016 KiB | 14 Q