<?php print "github"; function displayGreeting($hourofday) { print $hourofday; $hourofday = 11; if ($hourofday > 6 and $hourofday < 12) { print "Good morning\n"; } if ($hourofday > 12 and $hourofday < 17) { print "Good afternoon\n"; } if ($hourofday > 17 and $hourofday < 24) { print "Good night\n"; } } function buildPhp($isHtml) { } print displayGreeting($hourofday);
<body> <?php function displayGreeting($hourofday) { $hourofday = (int) $hourofday; switch ($hourofday) { case $hourofday >= 6 && $hourofday <= 11: $greeting = "Goodmorning"; break; case $hourofday >= 12 && $hourofday <= 17: $greeting = "Goodafternoon"; break; case $hourofday >= 18 && $hourofday <= 20: $greeting = "Goodevening"; break; case $hourofday >= 21 || $hourofday < 5: $greeting = "Goodnight"; break; } return $greeting; } print "The hour is 6 " . displayGreeting(6) . "<br>"; print "The hour is 12 " . displayGreeting(12) . "<br>"; print "The hour is 3 " . displayGreeting(3) . "<br>"; print "The hour is 19 " . displayGreeting(19) . "<br>"; ?> </body> </html>
<?php function displayGreeting($hourofday) { print $hourofday; $hourofday = 11; if ($hourofday > 6 and $hourofday < 12) { print "Good morning"; } if ($hourofday > 12 and $hourofday < 17) { print "Good afternoon"; } if ($hourofday > 17 and $hourofday < 24) { print "Good night"; } } print displayGreeting("<p" . $hourofday . "<p>"); print "Did this work? Yes!";