Synchronous time

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. :slight_smile:

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)

Thank your for this ScallioXTX