Php Code for a moving Time

Asked By 20 points N/A Posted on -
qa-featured

Hello there experts!

I am new to php programming and Im currently making a test site.

This site just served as my practice output.

I am planning to put the current time below but if I use the H:i:s, it wont move unless you refresh it.

Could anybody help me on this?

Thanks.

SHARE
Answered By 5 points N/A #100392

Php Code for a moving Time

qa-featured

 

Hi Sopatrick,

I think that's the way it is. PHP is a server side scripting language and is not able to do that as far as I know. You need a browser scripting like JavaScript to do that. PHP returns a HTTP request to the clients' browser like when you type https://www.techyv.com, display the desired information that is gathered in a specific web page. When you also click a button in the browser like a submit button that's the only time a request is sent to the web server which has PHP as server scripting on the other end. If you are going to implement a running clock using PHP, the behavior could be like; a request for new time is sent to the server and the current time will be returned to the browser and it’s an infinite request/respond loop if you are still in the page. There are a lot of browser scripting for the functionality that you can use and JavaScript is one that I can recommend to you.

I hope it helps.

Related Questions