+ 3
Why time doesn't change
In this code why setInterval function doesn't work. https://code.sololearn.com/wGGlDsCDMUPd/?ref=app
6 Respostas
+ 4
The code in PHP is interpreted by the server and subsequently displayed, so it is not fully dynamic.
You can create your code as WEB in Code Playground, that way it should work correctly.
+ 4
I found a method that works correctly in Code Plaground. It is quite easy to implement:
https://code.sololearn.com/wc81Eq9LSykd/#php
+ 3
I tried some methods in PHP and none worked correctly. So I think it would be best to do it, in this case, using Javascript in the following way:
https://www.w3schools.com/js/tryit.asp?filename=tryjs_timing_clock
+ 3
PHP is server script runs on request and response events.
Your JavaScript needs to keep requesting time information from server using api which is not the efficient way to perform since JavaScript could run its own clock from local device.
The only time local needs to request time from server when the server acts as a master clock center or time server for time synchronisation across the devices.
+ 2
I have already know about js but I want to use server side (php) clock.
+ 1
How can I fix it.