Simple PHP Help Script for Time-based Greetings | TNX

  • Thread starter Thread starter yaboo
  • Start date Start date
Click For Summary
SUMMARY

The forum discussion revolves around a PHP script intended for time-based greetings. The provided code checks the current hour and outputs "Hi" if the hour is less than or equal to 10, otherwise it outputs "bye". Users reported issues with the script not functioning as expected, despite the original poster's assertion that it works correctly on their machine. The discussion highlights the importance of error handling and debugging in PHP.

PREREQUISITES
  • Basic understanding of PHP syntax and functions
  • Familiarity with date and time functions in PHP
  • Knowledge of conditional statements in programming
  • Experience with debugging PHP scripts
NEXT STEPS
  • Learn about PHP error handling techniques
  • Explore PHP date and time functions in depth
  • Investigate common issues with PHP scripts and their resolutions
  • Practice writing and debugging PHP scripts for real-time applications
USEFUL FOR

PHP developers, beginners learning scripting, and anyone interested in creating dynamic web applications with time-based functionalities.

yaboo
Messages
4
Reaction score
0
script please help

PHP:
<?php
$time=date('H');
if($time<=10){
	$say='Hi';
}
else {
	$say='bye';
}
echo $say.'it is now '.date('H');
?>

it does not work,can u help me ?

TNX
 
Last edited:
Computer science news on Phys.org
Edit: actually no, I think that was wrong.

Are you getting error messages? The code works fine on my machine.
 
Last edited:

Similar threads

  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 21 ·
Replies
21
Views
6K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 22 ·
Replies
22
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 7 ·
Replies
7
Views
6K
  • · Replies 12 ·
Replies
12
Views
2K