Computer Science, asked by thecubersahil5524, 1 year ago

Write a php program to greet the user based on time

Answers

Answered by unknowntitle000
1

Answer:

on click

Explanation:

Answered by Jasleen0599
0

php program to greet the user based on time

<?php

// I'm India so my timezone is Asia/Calcutta

date_default_timezone_set('Asia/Calcutta');

// 24-hour format of an hour without leading zeros (0 through 23)

$Hour = date('G');

if ( $Hour >= 5 && $Hour <= 11 ) {

   echo "Good Morning";

} else if ( $Hour >= 12 && $Hour <= 18 ) {

   echo "Good Afternoon";

} else if ( $Hour >= 19 || $Hour <= 4 ) {

   echo "Good Evening";

}

?>

#SPJ3

Similar questions