3v4l.org

run code in 300+ PHP versions simultaneously
<?php print_r(getFirstDayInMonth(new DateTime())); function getFirstDayInMonth($date) { $firstDayInMonth = $date->modify("first day of this month"); if($firstDayInMonth->format("Y-m-d") == date("Y-m-d", easter_date($firstDayInMonth->format($firstDayInMonth->format("Y"))))) $firstDayInMonth->modify("+2 days"); // posunutí z neděle na úterý if($firstDayInMonth->format($firstDayInMonth->format("Y")) == 2024) $firstDayInMonth->modify("+1 day"); // 1. leden if($firstDayInMonth == new DateTime("1.1.".$firstDayInMonth->format("Y"))) $firstDayInMonth->modify("+1 day"); // 1. květen print_r($firstDayInMonth); print_r(new DateTime($firstDayInMonth->format("Y") . "-05-01")); if($firstDayInMonth == new DateTime($firstDayInMonth->format("Y") . "-05-01")) $firstDayInMonth->modify("+1 day"); // zjištění dnu v týdnu $numberOfDay = $firstDayInMonth->format("w"); //sobota if($numberOfDay == 6) $firstDayInMonth = $firstDayInMonth->modify("+2 days"); // neděle if($numberOfDay == 0) // ne $firstDayInMonth = $firstDayInMonth->modify("+1 day"); return $firstDayInMonth; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dYgTE
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_FCALL_BY_NAME                                       'getFirstDayInMonth'
          2        NEW                                              $0      'DateTime'
          3        DO_FCALL                                      0          
          4        SEND_VAR_NO_REF_EX                                       $0
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
   38     8      > RETURN                                                   1

Function getfirstdayinmonth:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 26
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 37
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 49
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 71, Position 2 = 74
Branch analysis from position: 71
2 jumps found. (Code = 43) Position 1 = 80, Position 2 = 84
Branch analysis from position: 80
2 jumps found. (Code = 43) Position 1 = 86, Position 2 = 90
Branch analysis from position: 86
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 90
Branch analysis from position: 84
Branch analysis from position: 74
Branch analysis from position: 49
Branch analysis from position: 37
Branch analysis from position: 26
filename:       /in/dYgTE
function name:  getFirstDayInMonth
number of ops:  92
compiled vars:  !0 = $date, !1 = $firstDayInMonth, !2 = $numberOfDay
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        INIT_METHOD_CALL                                         !0, 'modify'
          2        SEND_VAL_EX                                              'first+day+of+this+month'
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
    9     5        INIT_METHOD_CALL                                         !1, 'format'
          6        SEND_VAL_EX                                              'Y-m-d'
          7        DO_FCALL                                      0  $5      
          8        INIT_FCALL                                               'date'
          9        SEND_VAL                                                 'Y-m-d'
         10        INIT_FCALL_BY_NAME                                       'easter_date'
         11        INIT_METHOD_CALL                                         !1, 'format'
         12        INIT_METHOD_CALL                                         !1, 'format'
         13        SEND_VAL_EX                                              'Y'
         14        DO_FCALL                                      0  $6      
         15        SEND_VAR_NO_REF_EX                                       $6
         16        DO_FCALL                                      0  $7      
         17        SEND_VAR_NO_REF_EX                                       $7
         18        DO_FCALL                                      0  $8      
         19        SEND_VAR                                                 $8
         20        DO_ICALL                                         $9      
         21        IS_EQUAL                                                 $5, $9
         22      > JMPZ                                                     ~10, ->26
   10    23    >   INIT_METHOD_CALL                                         !1, 'modify'
         24        SEND_VAL_EX                                              '%2B2+days'
         25        DO_FCALL                                      0          
   12    26    >   INIT_METHOD_CALL                                         !1, 'format'
         27        INIT_METHOD_CALL                                         !1, 'format'
         28        SEND_VAL_EX                                              'Y'
         29        DO_FCALL                                      0  $12     
         30        SEND_VAR_NO_REF_EX                                       $12
         31        DO_FCALL                                      0  $13     
         32        IS_EQUAL                                                 $13, 2024
         33      > JMPZ                                                     ~14, ->37
   13    34    >   INIT_METHOD_CALL                                         !1, 'modify'
         35        SEND_VAL_EX                                              '%2B1+day'
         36        DO_FCALL                                      0          
   18    37    >   NEW                                              $16     'DateTime'
         38        INIT_METHOD_CALL                                         !1, 'format'
         39        SEND_VAL_EX                                              'Y'
         40        DO_FCALL                                      0  $17     
         41        CONCAT                                           ~18     '1.1.', $17
         42        SEND_VAL_EX                                              ~18
         43        DO_FCALL                                      0          
         44        IS_EQUAL                                                 !1, $16
         45      > JMPZ                                                     ~20, ->49
   19    46    >   INIT_METHOD_CALL                                         !1, 'modify'
         47        SEND_VAL_EX                                              '%2B1+day'
         48        DO_FCALL                                      0          
   21    49    >   INIT_FCALL                                               'print_r'
         50        SEND_VAR                                                 !1
         51        DO_ICALL                                                 
   22    52        INIT_FCALL                                               'print_r'
         53        NEW                                              $23     'DateTime'
         54        INIT_METHOD_CALL                                         !1, 'format'
         55        SEND_VAL_EX                                              'Y'
         56        DO_FCALL                                      0  $24     
         57        CONCAT                                           ~25     $24, '-05-01'
         58        SEND_VAL_EX                                              ~25
         59        DO_FCALL                                      0          
         60        SEND_VAR                                                 $23
         61        DO_ICALL                                                 
   23    62        NEW                                              $28     'DateTime'
         63        INIT_METHOD_CALL                                         !1, 'format'
         64        SEND_VAL_EX                                              'Y'
         65        DO_FCALL                                      0  $29     
         66        CONCAT                                           ~30     $29, '-05-01'
         67        SEND_VAL_EX                                              ~30
         68        DO_FCALL                                      0          
         69        IS_EQUAL                                                 !1, $28
         70      > JMPZ                                                     ~32, ->74
   24    71    >   INIT_METHOD_CALL                                         !1, 'modify'
         72        SEND_VAL_EX                                              '%2B1+day'
         73        DO_FCALL                                      0          
   27    74    >   INIT_METHOD_CALL                                         !1, 'format'
         75        SEND_VAL_EX                                              'w'
         76        DO_FCALL                                      0  $34     
         77        ASSIGN                                                   !2, $34
   30    78        IS_EQUAL                                                 !2, 6
         79      > JMPZ                                                     ~36, ->84
   31    80    >   INIT_METHOD_CALL                                         !1, 'modify'
         81        SEND_VAL_EX                                              '%2B2+days'
         82        DO_FCALL                                      0  $37     
         83        ASSIGN                                                   !1, $37
   33    84    >   IS_EQUAL                                                 !2, 0
         85      > JMPZ                                                     ~39, ->90
   34    86    >   INIT_METHOD_CALL                                         !1, 'modify'
         87        SEND_VAL_EX                                              '%2B1+day'
         88        DO_FCALL                                      0  $40     
         89        ASSIGN                                                   !1, $40
   36    90    > > RETURN                                                   !1
   38    91*     > RETURN                                                   null

End of function getfirstdayinmonth

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.32 ms | 1020 KiB | 15 Q