3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = strtotime("01-jan-2018"); $next = strtotime("next day", $start); $festivi = array( "Capodanno" => getMyDate("01-jan-2018"), "Epifania" => getMyDate("06-jan-2018"), "Pasqua" => getMyDate("01-apr-2018"), "Pasquetta" => getMyDate("02-apr-2018"), "Liberazione" => getMyDate("25-apr-2018"), "Lavoratori" => getMyDate("01-mag-2018"), "Repubblica" => getMyDate("02-jun-2018"), "Patrono" => getMyDate("29-jun-2018"), "Ferragosto" => getMyDate("15-aug-2018"), "TuttiSanti" => getMyDate("01-nov-2018"), "Immacolata" => getMyDate("08-dic-2018"), "Natale" => getMyDate("25-dic-2018"), "SantoStefano" => getMyDate("26-dic-2018") ); while($start != strtotime("01 jan 2019")){ if(isFestivo($festivi, $start)) echo date('d/m/Y', $start)."\t".$festivo[getFestivoIndex($festivi, $start)]["descrizione"]."\n"; else if(date('w',$start)==6) echo date('d/m/Y', $start)."\tS\n"; else if(date('w',$start)==7) echo date('d/m/Y', $start)."\tD\n"; else $start = strtotime("next day", $start); $start = strtotime("next day", $start); } function getMyDate($myDate){ return date('d/m/Y', strtotime($myDate)); } function isFestivo($festivi, $myDate){ foreach($festivi as $tempDescription => $tempDate) if($myDate == $tempDate) return true; return false; } function getFestivoIndex($festivi,$myDate){ $count = 0; foreach($festivi as $tempDescription => $tempDate) if($myDate == $tempDate) return $count; else $count++; return -1; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 119
Branch analysis from position: 119
2 jumps found. (Code = 44) Position 1 = 124, Position 2 = 63
Branch analysis from position: 124
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 63
2 jumps found. (Code = 43) Position 1 = 68, Position 2 = 83
Branch analysis from position: 68
1 jumps found. (Code = 42) Position 1 = 114
Branch analysis from position: 114
2 jumps found. (Code = 44) Position 1 = 124, Position 2 = 63
Branch analysis from position: 124
Branch analysis from position: 63
Branch analysis from position: 83
2 jumps found. (Code = 43) Position 1 = 89, Position 2 = 96
Branch analysis from position: 89
1 jumps found. (Code = 42) Position 1 = 114
Branch analysis from position: 114
Branch analysis from position: 96
2 jumps found. (Code = 43) Position 1 = 102, Position 2 = 109
Branch analysis from position: 102
1 jumps found. (Code = 42) Position 1 = 114
Branch analysis from position: 114
Branch analysis from position: 109
2 jumps found. (Code = 44) Position 1 = 124, Position 2 = 63
Branch analysis from position: 124
Branch analysis from position: 63
filename:       /in/0u0a6
function name:  (null)
number of ops:  125
compiled vars:  !0 = $start, !1 = $next, !2 = $festivi, !3 = $festivo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'strtotime'
          1        SEND_VAL                                                 '01-jan-2018'
          2        DO_ICALL                                         $4      
          3        ASSIGN                                                   !0, $4
    3     4        INIT_FCALL                                               'strtotime'
          5        SEND_VAL                                                 'next+day'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !1, $6
    7     9        INIT_FCALL_BY_NAME                                       'getMyDate'
         10        SEND_VAL_EX                                              '01-jan-2018'
         11        DO_FCALL                                      0  $8      
         12        INIT_ARRAY                                       ~9      $8, 'Capodanno'
    8    13        INIT_FCALL_BY_NAME                                       'getMyDate'
         14        SEND_VAL_EX                                              '06-jan-2018'
         15        DO_FCALL                                      0  $10     
         16        ADD_ARRAY_ELEMENT                                ~9      $10, 'Epifania'
    9    17        INIT_FCALL_BY_NAME                                       'getMyDate'
         18        SEND_VAL_EX                                              '01-apr-2018'
         19        DO_FCALL                                      0  $11     
         20        ADD_ARRAY_ELEMENT                                ~9      $11, 'Pasqua'
   10    21        INIT_FCALL_BY_NAME                                       'getMyDate'
         22        SEND_VAL_EX                                              '02-apr-2018'
         23        DO_FCALL                                      0  $12     
         24        ADD_ARRAY_ELEMENT                                ~9      $12, 'Pasquetta'
   11    25        INIT_FCALL_BY_NAME                                       'getMyDate'
         26        SEND_VAL_EX                                              '25-apr-2018'
         27        DO_FCALL                                      0  $13     
         28        ADD_ARRAY_ELEMENT                                ~9      $13, 'Liberazione'
   12    29        INIT_FCALL_BY_NAME                                       'getMyDate'
         30        SEND_VAL_EX                                              '01-mag-2018'
         31        DO_FCALL                                      0  $14     
         32        ADD_ARRAY_ELEMENT                                ~9      $14, 'Lavoratori'
   13    33        INIT_FCALL_BY_NAME                                       'getMyDate'
         34        SEND_VAL_EX                                              '02-jun-2018'
         35        DO_FCALL                                      0  $15     
         36        ADD_ARRAY_ELEMENT                                ~9      $15, 'Repubblica'
   14    37        INIT_FCALL_BY_NAME                                       'getMyDate'
         38        SEND_VAL_EX                                              '29-jun-2018'
         39        DO_FCALL                                      0  $16     
         40        ADD_ARRAY_ELEMENT                                ~9      $16, 'Patrono'
   15    41        INIT_FCALL_BY_NAME                                       'getMyDate'
         42        SEND_VAL_EX                                              '15-aug-2018'
         43        DO_FCALL                                      0  $17     
         44        ADD_ARRAY_ELEMENT                                ~9      $17, 'Ferragosto'
   16    45        INIT_FCALL_BY_NAME                                       'getMyDate'
         46        SEND_VAL_EX                                              '01-nov-2018'
         47        DO_FCALL                                      0  $18     
         48        ADD_ARRAY_ELEMENT                                ~9      $18, 'TuttiSanti'
   17    49        INIT_FCALL_BY_NAME                                       'getMyDate'
         50        SEND_VAL_EX                                              '08-dic-2018'
         51        DO_FCALL                                      0  $19     
         52        ADD_ARRAY_ELEMENT                                ~9      $19, 'Immacolata'
   18    53        INIT_FCALL_BY_NAME                                       'getMyDate'
         54        SEND_VAL_EX                                              '25-dic-2018'
         55        DO_FCALL                                      0  $20     
         56        ADD_ARRAY_ELEMENT                                ~9      $20, 'Natale'
   19    57        INIT_FCALL_BY_NAME                                       'getMyDate'
         58        SEND_VAL_EX                                              '26-dic-2018'
         59        DO_FCALL                                      0  $21     
         60        ADD_ARRAY_ELEMENT                                ~9      $21, 'SantoStefano'
    5    61        ASSIGN                                                   !2, ~9
   25    62      > JMP                                                      ->119
   26    63    >   INIT_FCALL_BY_NAME                                       'isFestivo'
         64        SEND_VAR_EX                                              !2
         65        SEND_VAR_EX                                              !0
         66        DO_FCALL                                      0  $23     
         67      > JMPZ                                                     $23, ->83
   27    68    >   INIT_FCALL                                               'date'
         69        SEND_VAL                                                 'd%2Fm%2FY'
         70        SEND_VAR                                                 !0
         71        DO_ICALL                                         $24     
         72        CONCAT                                           ~25     $24, '%09'
         73        INIT_FCALL_BY_NAME                                       'getFestivoIndex'
         74        SEND_VAR_EX                                              !2
         75        SEND_VAR_EX                                              !0
         76        DO_FCALL                                      0  $26     
         77        FETCH_DIM_R                                      ~27     !3, $26
         78        FETCH_DIM_R                                      ~28     ~27, 'descrizione'
         79        CONCAT                                           ~29     ~25, ~28
         80        CONCAT                                           ~30     ~29, '%0A'
         81        ECHO                                                     ~30
         82      > JMP                                                      ->114
   28    83    >   INIT_FCALL                                               'date'
         84        SEND_VAL                                                 'w'
         85        SEND_VAR                                                 !0
         86        DO_ICALL                                         $31     
         87        IS_EQUAL                                                 $31, 6
         88      > JMPZ                                                     ~32, ->96
   29    89    >   INIT_FCALL                                               'date'
         90        SEND_VAL                                                 'd%2Fm%2FY'
         91        SEND_VAR                                                 !0
         92        DO_ICALL                                         $33     
         93        CONCAT                                           ~34     $33, '%09S%0A'
         94        ECHO                                                     ~34
         95      > JMP                                                      ->114
   30    96    >   INIT_FCALL                                               'date'
         97        SEND_VAL                                                 'w'
         98        SEND_VAR                                                 !0
         99        DO_ICALL                                         $35     
        100        IS_EQUAL                                                 $35, 7
        101      > JMPZ                                                     ~36, ->109
   31   102    >   INIT_FCALL                                               'date'
        103        SEND_VAL                                                 'd%2Fm%2FY'
        104        SEND_VAR                                                 !0
        105        DO_ICALL                                         $37     
        106        CONCAT                                           ~38     $37, '%09D%0A'
        107        ECHO                                                     ~38
        108      > JMP                                                      ->114
   33   109    >   INIT_FCALL                                               'strtotime'
        110        SEND_VAL                                                 'next+day'
        111        SEND_VAR                                                 !0
        112        DO_ICALL                                         $39     
        113        ASSIGN                                                   !0, $39
   34   114    >   INIT_FCALL                                               'strtotime'
        115        SEND_VAL                                                 'next+day'
        116        SEND_VAR                                                 !0
        117        DO_ICALL                                         $41     
        118        ASSIGN                                                   !0, $41
   25   119    >   INIT_FCALL                                               'strtotime'
        120        SEND_VAL                                                 '01+jan+2019'
        121        DO_ICALL                                         $43     
        122        IS_NOT_EQUAL                                             !0, $43
        123      > JMPNZ                                                    ~44, ->63
   59   124    > > RETURN                                                   1

Function getmydate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0u0a6
function name:  getMyDate
number of ops:  10
compiled vars:  !0 = $myDate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   RECV                                             !0      
   39     1        INIT_FCALL                                               'date'
          2        SEND_VAL                                                 'd%2Fm%2FY'
          3        INIT_FCALL                                               'strtotime'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $1      
          6        SEND_VAR                                                 $1
          7        DO_ICALL                                         $2      
          8      > RETURN                                                   $2
   41     9*     > RETURN                                                   null

End of function getmydate

Function isfestivo:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/0u0a6
function name:  isFestivo
number of ops:  13
compiled vars:  !0 = $festivi, !1 = $myDate, !2 = $tempDate, !3 = $tempDescription
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   44     2      > FE_RESET_R                                       $4      !0, ->10
          3    > > FE_FETCH_R                                       ~5      $4, !2, ->10
          4    >   ASSIGN                                                   !3, ~5
   45     5        IS_EQUAL                                                 !1, !2
          6      > JMPZ                                                     ~7, ->9
   46     7    >   FE_FREE                                                  $4
          8      > RETURN                                                   <true>
   44     9    > > JMP                                                      ->3
         10    >   FE_FREE                                                  $4
   47    11      > RETURN                                                   <false>
   48    12*     > RETURN                                                   null

End of function isfestivo

Function getfestivoindex:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/0u0a6
function name:  getFestivoIndex
number of ops:  16
compiled vars:  !0 = $festivi, !1 = $myDate, !2 = $count, !3 = $tempDate, !4 = $tempDescription
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   52     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   53     2        ASSIGN                                                   !2, 0
   54     3      > FE_RESET_R                                       $6      !0, ->13
          4    > > FE_FETCH_R                                       ~7      $6, !3, ->13
          5    >   ASSIGN                                                   !4, ~7
   55     6        IS_EQUAL                                                 !1, !3
          7      > JMPZ                                                     ~9, ->11
   56     8    >   FE_FREE                                                  $6
          9      > RETURN                                                   !2
         10*       JMP                                                      ->12
   57    11    >   PRE_INC                                                  !2
   54    12      > JMP                                                      ->4
         13    >   FE_FREE                                                  $6
   58    14      > RETURN                                                   -1
   59    15*     > RETURN                                                   null

End of function getfestivoindex

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.26 ms | 1412 KiB | 17 Q