jemz
October 19, 2013, 7:10am
1
Hi, Is it possible in PHP that my time will be synchronous ?
$time = date('g:i:s a');
echo "Time is exactly: $time";
I need to refresh the page first in order my time will be updated,but what i want is to make my time synchronous, is this possible in php?
Thank you in advance.
rpkamp
October 19, 2013, 8:12am
2
No. PHP is only generated once the page loads, after that you can’t do anything with it. To just show the time, you might want to look at javascript.
Here is a nice tutorial to get you started: http://www.elated.com/articles/creating-a-javascript-clock/
(technically I suppose you could do it with AJAX, but that’s waaaay overkill for this particular problem)
jemz
October 19, 2013, 11:09am
3
Thank your for this ScallioXTX