Test_Lindnau_a - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of Test_Lindnau_a.php
- <?php
- $Geb_Jahr = "a";
- $Geb_Monat = 11;
- $Akt_Jahr = 2023;
- $Akt_Monat = 9;
- if($Geb_Jahr > $Akt_Jahr)
- {
- echo "Falsche Eingabe! Das Geburtsjahr liegt in der Zukunft!";
- }
- else
- {
- if($Geb_Monat == $Akt_Monat)
- {
- $Geb_Tag = 2;
- $Akt_Tag = 11;
- if($Geb_Tag <= $Akt_Tag)
- {
- $alter = $Akt_Jahr - $Geb_Jahr;
- }
- else
- {
- $alter = $Akt_Jahr - $Geb_Jahr - 1;
- }
- }
- else
- {
- if($Geb_Monat < $Akt_Monat)
- {
- $alter = $Akt_Jahr - $Geb_Jahr;
- }
- else
- {
- $alter = $Akt_Jahr - $Geb_Jahr - 1;
- }
- }
- echo $alter;
- if($alter < 18)
- {
- echo " Sie sind minderjährig";
- }
- else if($alter > 65)
- {
- echo " Sie sind Rentner";
- }
- else
- {
- echo " Sie sind erwachsen";
- }
- }
- ?>