Forum Moderators: coopster
If i create a variable like:
$today=time();
$f_today=date("l, F j, Y", $today);
$f_time=("H:i:s A", $today);
if i do
echo "Today is $f_today. The time is $_time";
That would output obviously for example "Today is Tuesday, April 1, 2008. The time is 18:55:24 PM"
My question is: How can i make the clock, especially the seconds to keep counting visually the time on the screen. I suspect there is a loop inside that, but don't know how to write it.
Have fun there, and thanks already for your upcoming help.
If you want a clock that runs in PHP you are going to have send requests back and forth through this process every second! Don't do it! Use the tools available that were made just for this type of feature, in this case that tool is client-side code, JavaScript.
As great as php is, it is not a client side language. You could always use ajax to get the magic of php onto your client side ;) (although in this case that is probably more hassle than it is worth)
to read a timed output feed of the time
Still, as has been discussed, it is crazy to work your server like that when the tools designed for tasks like this already exist in the browser. I just wanted to emphasize that point one more time for the OP :)