3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Erstellt von: Alex Volk / FIU13WS // Erstellt am: 28.03.2014 // Erweitert am: 31.03.2014 // Geaendert am: 11.04.2014 // ================================================================================= // Ergebnis Formular anzeigen // Variable Ergebnis eintragen // ================================================================================= $_POST['tag'] = ''; $_POST['monat'] = ''; $_POST['jahr'] = ''; $formular = '<section id="wrapper"> <header> <h1>Ermittlung des Wochentages</h1> </header> <section id="form_inhalt"> <form action="' . ($_SERVER['PHP_SELF']) . '" method="POST" > <fieldset class="formular33prozent"; text-align: right;> <legend>Bitte ein Datum eingeben</legend> <label for="tag">Tag:</label> <input type="text" name="tag" id="tag" placeholder="31" value="'.$_POST['tag'].'" required autofocus/> <br /> <label for="monat">Monat:</label> <input type="text" name="monat" id="monat" placeholder="03" value="'.$_POST['monat'].'" required/> <br /> <label for="jahr">Jahr:</label> <input type="text" name="jahr" id="jahr" placeholder="2014" value="'.$_POST['jahr'].'" required/> <br /> <br /> <input type="button" onClick="location.href=\'' . $_SERVER["SCRIPT_NAME"] .'\''.'" value="Nicht berechnen" /> <input id="submit" name="submit" type="submit" value="Berechnen"/> </fieldset> </form> </section> '; if (isset($_POST['submit'])) // prueft, ob die Eingabe gesetzt wurde { //=================================================================================== // Deklaration und Initialisierung der Variablen //=================================================================================== // vom user eingegebene Daten des Datums $tag = $_POST['tag']; $monat = $_POST['monat']; $jahr = $_POST['jahr']; // TESTAUSGABE DER VARIABLEN // echo('$tag = '.$tag .'<br/>'); // echo('$monat = '.$monat .'<br/>'); // echo('$jahr = '.$jahr .'<br/>'); // Hilfs und Ergebnisvariablen $jahr1 = 0; $jahr2 = 0; $h1 = 0; $h2 = 0; $h3 = 0; $b = 0; $f = 0; //=================================================================================== // Ausgabe der 'eingegeben' bzw. gegebenen Daten des Datums //=================================================================================== // echo('Sie haben folgendes Datum eingegeben: '.$tag.'.'.$monat.'.'.$jahr.'<br/><br/>'); //=====Schritt 1===================================================================== // Pruefen ob $monat kleiner ist als 3 //=================================================================================== if ($monat < 3) { $monat = $monat + 10; $jahr = $jahr - 1; } else { $monat = $monat - 2; } // Testweises anzeigen des Inhaltes von $monat // echo('$monat = '.$monat.'<br/>'); //=====Schritt 2===================================================================== // Berechnung Hilfsvariablen JAHR1 und Ermittlung des ganzzahligen Teiles (DIV) //=================================================================================== $jahr1 = floor($jahr/100); //=====Schritt 3===================================================================== // Berechnung Hilfsvariablen JAHR2 und Ermittlung des ganzzahligen Restes (MOD) //=================================================================================== $jahr2 = $jahr%100; //=====Schritt 4===================================================================== // Berechnung Hilfsvariablen H1 und Ermittlung des ganzzahligen Teiles (DIV) //=================================================================================== $h1 = floor((($monat * 13)-1)/5); //=====Schritt 5===================================================================== // Berechnung Hilfsvariablen H2 und Ermittlung des ganzzahligen Teiles (DIV) //=================================================================================== $h2 = floor($jahr2/4); //=====Schritt 6===================================================================== // Berechnung Hilfsvariablen H3 und Ermittlung des ganzzahligen Teiles (DIV) //=================================================================================== $h3 = floor($jahr1/4); //=====Schritt 7===================================================================== // Berechnung Hilfsvariablen B //=================================================================================== $b = $h1 + $h2 + $h3; //=====Schritt 8===================================================================== // Ermittlung der Zahl F fuer den Wochentag //=================================================================================== $f = ((($b + $jahr2 + $tag)-(2 * $jahr1))%7); // Testweises anzeigen des Inhaltes von $f // echo('$f = '.$f.'<br/>'); //=====Schritt 8.1===================================================================== // Pruefen ob F negativ - wenn ja, dann addiere 7 //=================================================================================== if ($f < 0) { $f += 7; } // Testweises anzeigen des Inhaltes von $f //echo('$f = '.$f.'<br/>'); //=====Schritt 9===================================================================== // Ermittlung und Ausgabe des Wochentages //=================================================================================== if ($f == 0) { $ergebnis = 'Sonntag'; } elseif ($f == 1) { $ergebnis = 'Montag'; } elseif ($f == 2) { $ergebnis = 'Dienstag'; } elseif ($f == 3) { $ergebnis = 'Mittwoch'; } elseif ($f == 4) { $ergebnis = 'Donnerstag'; } elseif ($f == 5) { $ergebnis = 'Freitag'; } elseif ($f == 6) { $ergebnis = 'Samstag'; } else { $ergebnis = 'nichts gefunden!'; } echo $formular; //=================================================================================== // Ausgabe des Wochentages //=================================================================================== echo(' <form> <fieldset class="formular33prozent"> <legend>Ergebnis der Berechnung</legend> Der gesuchte Wochentag lautet: <input type="text" name="test3_ausgabe" value="'.$ergebnis.'" size="20" /> </fieldset> </form> '); // TESTAUSGABE DER VARIABLEN /* echo('$tag = '.$tag .'<br/>'); echo('$monat = '.$monat .'<br/>'); echo('$jahr = '.$jahr .'<br/>'); echo('$jahr1 = '.$jahr1 .'<br/>'); echo('$jahr2 = '.$jahr2 .'<br/>'); echo('$h1 = '.$h1 .'<br/>'); echo('$h2 = '.$h2 .'<br/>'); echo('$h3 = '.$h3 .'<br/>'); echo('$b = '.$b .'<br/>'); echo('$f = '.$f .'<br/>'); */ } else { echo $formular; } ?> </section> </section>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 129
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 57
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
2 jumps found. (Code = 43) Position 1 = 94, Position 2 = 95
Branch analysis from position: 94
2 jumps found. (Code = 43) Position 1 = 97, Position 2 = 99
Branch analysis from position: 97
1 jumps found. (Code = 42) Position 1 = 124
Branch analysis from position: 124
1 jumps found. (Code = 42) Position 1 = 130
Branch analysis from position: 130
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 99
2 jumps found. (Code = 43) Position 1 = 101, Position 2 = 103
Branch analysis from position: 101
1 jumps found. (Code = 42) Position 1 = 124
Branch analysis from position: 124
Branch analysis from position: 103
2 jumps found. (Code = 43) Position 1 = 105, Position 2 = 107
Branch analysis from position: 105
1 jumps found. (Code = 42) Position 1 = 124
Branch analysis from position: 124
Branch analysis from position: 107
2 jumps found. (Code = 43) Position 1 = 109, Position 2 = 111
Branch analysis from position: 109
1 jumps found. (Code = 42) Position 1 = 124
Branch analysis from position: 124
Branch analysis from position: 111
2 jumps found. (Code = 43) Position 1 = 113, Position 2 = 115
Branch analysis from position: 113
1 jumps found. (Code = 42) Position 1 = 124
Branch analysis from position: 124
Branch analysis from position: 115
2 jumps found. (Code = 43) Position 1 = 117, Position 2 = 119
Branch analysis from position: 117
1 jumps found. (Code = 42) Position 1 = 124
Branch analysis from position: 124
Branch analysis from position: 119
2 jumps found. (Code = 43) Position 1 = 121, Position 2 = 123
Branch analysis from position: 121
1 jumps found. (Code = 42) Position 1 = 124
Branch analysis from position: 124
Branch analysis from position: 123
1 jumps found. (Code = 42) Position 1 = 130
Branch analysis from position: 130
Branch analysis from position: 95
Branch analysis from position: 57
2 jumps found. (Code = 43) Position 1 = 94, Position 2 = 95
Branch analysis from position: 94
Branch analysis from position: 95
Branch analysis from position: 129
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/W4bAM
function name:  (null)
number of ops:  132
compiled vars:  !0 = $formular, !1 = $tag, !2 = $monat, !3 = $jahr, !4 = $jahr1, !5 = $jahr2, !6 = $h1, !7 = $h2, !8 = $h3, !9 = $b, !10 = $f, !11 = $ergebnis
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   FETCH_W                      global              $12     '_POST'
          1        ASSIGN_DIM                                               $12, 'tag'
          2        OP_DATA                                                  ''
   13     3        FETCH_W                      global              $14     '_POST'
          4        ASSIGN_DIM                                               $14, 'monat'
          5        OP_DATA                                                  ''
   14     6        FETCH_W                      global              $16     '_POST'
          7        ASSIGN_DIM                                               $16, 'jahr'
          8        OP_DATA                                                  ''
   24     9        FETCH_R                      global              ~18     '_SERVER'
         10        FETCH_DIM_R                                      ~19     ~18, 'PHP_SELF'
         11        CONCAT                                           ~20     '%3Csection+id%3D%22wrapper%22%3E%0A%09%09%09%3Cheader%3E%0A%09%09%09%09%3Ch1%3EErmittlung+des+Wochentages%3C%2Fh1%3E%0A%09%09%09%3C%2Fheader%3E%0A%09%09%09%0A%09%09%09%3Csection+id%3D%22form_inhalt%22%3E%0A%09%09%09%09%3Cform+action%3D%22', ~19
         12        CONCAT                                           ~21     ~20, '%22+method%3D%22POST%22+%3E%0A%09%09%09%09%09%3Cfieldset+class%3D%22formular33prozent%22%3B+text-align%3A+right%3B%3E%0A%09%09%09%09%09%09%3Clegend%3EBitte+ein+Datum+eingeben%3C%2Flegend%3E%0A%09%09%09%09%09%09%0A%09%09%09%09%09%09%3Clabel+for%3D%22tag%22%3ETag%3A%3C%2Flabel%3E%0A%09%09%09%09%09%09%09%3Cinput+type%3D%22text%22+name%3D%22tag%22+id%3D%22tag%22+placeholder%3D%2231%22+value%3D%22'
   29    13        FETCH_R                      global              ~22     '_POST'
         14        FETCH_DIM_R                                      ~23     ~22, 'tag'
         15        CONCAT                                           ~24     ~21, ~23
         16        CONCAT                                           ~25     ~24, '%22+required+autofocus%2F%3E%0A%09%09%09%09%09%09%09%3Cbr+%2F%3E%0A%09%09%09%09%09%09%3Clabel+for%3D%22monat%22%3EMonat%3A%3C%2Flabel%3E%0A%09%09%09%09%09%09%09%3Cinput+type%3D%22text%22+name%3D%22monat%22+id%3D%22monat%22+placeholder%3D%2203%22+value%3D%22'
   32    17        FETCH_R                      global              ~26     '_POST'
         18        FETCH_DIM_R                                      ~27     ~26, 'monat'
         19        CONCAT                                           ~28     ~25, ~27
         20        CONCAT                                           ~29     ~28, '%22+required%2F%3E%0A%09%09%09%09%09%09%09%3Cbr+%2F%3E%0A%09%09%09%09%09%09%3Clabel+for%3D%22jahr%22%3EJahr%3A%3C%2Flabel%3E%0A%09%09%09%09%09%09%09%3Cinput+type%3D%22text%22+name%3D%22jahr%22+id%3D%22jahr%22+placeholder%3D%222014%22+value%3D%22'
   35    21        FETCH_R                      global              ~30     '_POST'
         22        FETCH_DIM_R                                      ~31     ~30, 'jahr'
         23        CONCAT                                           ~32     ~29, ~31
         24        CONCAT                                           ~33     ~32, '%22+required%2F%3E%0A%09%09%09%09%09%09%09%3Cbr+%2F%3E%0A%09%09%09%09%09%09%09%3Cbr+%2F%3E%0A%09%09%09%09%09%09%3Cinput+type%3D%22button%22+onClick%3D%22location.href%3D%27'
   38    25        FETCH_R                      global              ~34     '_SERVER'
         26        FETCH_DIM_R                                      ~35     ~34, 'SCRIPT_NAME'
         27        CONCAT                                           ~36     ~33, ~35
         28        CONCAT                                           ~37     ~36, '%27'
         29        CONCAT                                           ~38     ~37, '%22+value%3D%22Nicht+berechnen%22+%2F%3E%09%0A%09%09%09%09%09%09%0A%09%09%09%09%09%09%3Cinput+id%3D%22submit%22+name%3D%22submit%22+type%3D%22submit%22+value%3D%22Berechnen%22%2F%3E%0A%09%09%09%09%09%3C%2Ffieldset%3E%0A%09%09%09%09%3C%2Fform%3E%0A%09%09%09%3C%2Fsection%3E%0A%09%09++++'
   18    30        ASSIGN                                                   !0, ~38
   48    31        FETCH_IS                                         ~40     '_POST'
         32        ISSET_ISEMPTY_DIM_OBJ                         0          ~40, 'submit'
         33      > JMPZ                                                     ~41, ->129
   54    34    >   FETCH_R                      global              ~42     '_POST'
         35        FETCH_DIM_R                                      ~43     ~42, 'tag'
         36        ASSIGN                                                   !1, ~43
   55    37        FETCH_R                      global              ~45     '_POST'
         38        FETCH_DIM_R                                      ~46     ~45, 'monat'
         39        ASSIGN                                                   !2, ~46
   56    40        FETCH_R                      global              ~48     '_POST'
         41        FETCH_DIM_R                                      ~49     ~48, 'jahr'
         42        ASSIGN                                                   !3, ~49
   64    43        ASSIGN                                                   !4, 0
   65    44        ASSIGN                                                   !5, 0
   66    45        ASSIGN                                                   !6, 0
   67    46        ASSIGN                                                   !7, 0
   68    47        ASSIGN                                                   !8, 0
   69    48        ASSIGN                                                   !9, 0
   70    49        ASSIGN                                                   !10, 0
   80    50        IS_SMALLER                                               !2, 3
         51      > JMPZ                                                     ~58, ->57
   82    52    >   ADD                                              ~59     !2, 10
         53        ASSIGN                                                   !2, ~59
   83    54        SUB                                              ~61     !3, 1
         55        ASSIGN                                                   !3, ~61
         56      > JMP                                                      ->59
   87    57    >   SUB                                              ~63     !2, 2
         58        ASSIGN                                                   !2, ~63
   95    59    >   INIT_FCALL                                               'floor'
         60        DIV                                              ~65     !3, 100
         61        SEND_VAL                                                 ~65
         62        DO_ICALL                                         $66     
         63        ASSIGN                                                   !4, $66
  100    64        MOD                                              ~68     !3, 100
         65        ASSIGN                                                   !5, ~68
  105    66        INIT_FCALL                                               'floor'
         67        MUL                                              ~70     !2, 13
         68        SUB                                              ~71     ~70, 1
         69        DIV                                              ~72     ~71, 5
         70        SEND_VAL                                                 ~72
         71        DO_ICALL                                         $73     
         72        ASSIGN                                                   !6, $73
  110    73        INIT_FCALL                                               'floor'
         74        DIV                                              ~75     !5, 4
         75        SEND_VAL                                                 ~75
         76        DO_ICALL                                         $76     
         77        ASSIGN                                                   !7, $76
  115    78        INIT_FCALL                                               'floor'
         79        DIV                                              ~78     !4, 4
         80        SEND_VAL                                                 ~78
         81        DO_ICALL                                         $79     
         82        ASSIGN                                                   !8, $79
  120    83        ADD                                              ~81     !6, !7
         84        ADD                                              ~82     ~81, !8
         85        ASSIGN                                                   !9, ~82
  125    86        ADD                                              ~84     !9, !5
         87        ADD                                              ~85     ~84, !1
         88        MUL                                              ~86     !4, 2
         89        SUB                                              ~87     ~85, ~86
         90        MOD                                              ~88     ~87, 7
         91        ASSIGN                                                   !10, ~88
  134    92        IS_SMALLER                                               !10, 0
         93      > JMPZ                                                     ~90, ->95
  135    94    >   ASSIGN_OP                                     1          !10, 7
  145    95    >   IS_EQUAL                                                 !10, 0
         96      > JMPZ                                                     ~92, ->99
  147    97    >   ASSIGN                                                   !11, 'Sonntag'
         98      > JMP                                                      ->124
  149    99    >   IS_EQUAL                                                 !10, 1
        100      > JMPZ                                                     ~94, ->103
  151   101    >   ASSIGN                                                   !11, 'Montag'
        102      > JMP                                                      ->124
  153   103    >   IS_EQUAL                                                 !10, 2
        104      > JMPZ                                                     ~96, ->107
  155   105    >   ASSIGN                                                   !11, 'Dienstag'
        106      > JMP                                                      ->124
  157   107    >   IS_EQUAL                                                 !10, 3
        108      > JMPZ                                                     ~98, ->111
  159   109    >   ASSIGN                                                   !11, 'Mittwoch'
        110      > JMP                                                      ->124
  161   111    >   IS_EQUAL                                                 !10, 4
        112      > JMPZ                                                     ~100, ->115
  163   113    >   ASSIGN                                                   !11, 'Donnerstag'
        114      > JMP                                                      ->124
  165   115    >   IS_EQUAL                                                 !10, 5
        116      > JMPZ                                                     ~102, ->119
  167   117    >   ASSIGN                                                   !11, 'Freitag'
        118      > JMP                                                      ->124
  169   119    >   IS_EQUAL                                                 !10, 6
        120      > JMPZ                                                     ~104, ->123
  171   121    >   ASSIGN                                                   !11, 'Samstag'
        122      > JMP                                                      ->124
  175   123    >   ASSIGN                                                   !11, 'nichts+gefunden%21'
  179   124    >   ECHO                                                     !0
  190   125        CONCAT                                           ~107    '%0A%09%09%09%09%3Cform%3E%0A%09%09%09%09%09%3Cfieldset+class%3D%22formular33prozent%22%3E%0A%09%09%09%09%09%09%3Clegend%3EErgebnis+der+Berechnung%3C%2Flegend%3E%0A%09%09%09%0A%09%09%09%09%09%09Der+gesuchte+Wochentag+lautet%3A+%0A%09%09%09%09%09%09%3Cinput+type%3D%22text%22+name%3D%22test3_ausgabe%22+value%3D%22', !11
        126        CONCAT                                           ~108    ~107, '%22+size%3D%2220%22+%2F%3E%0A%0A%09%09%09%09%09%3C%2Ffieldset%3E%0A%09%09%09%09%3C%2Fform%3E%09++++++++%0A++++++++++++%09'
        127        ECHO                                                     ~108
        128      > JMP                                                      ->130
  216   129    >   ECHO                                                     !0
  219   130    >   ECHO                                                     '%09%09%09%3C%2Fsection%3E%0A%09%09%3C%2Fsection%3E'
  220   131      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.37 ms | 1408 KiB | 15 Q