-1
Does anyone know any timer function like javascript setTimeOut: https://www.w3schools.com/jsref/met_win_settimeout.asp
Only in PHP?
Because I’m trying to do it with Sleep, but the page keeps loading endlessly.
function Criar_Madeira($a) {
$a->madeira += 500;
sleep(10);
Criar_Madeira($a);
}
Criar_Madeira($a[1]);
Your function never ends because you have created a function with recursiveness. Don’t forget that PHP is a server side language, that is while your PHP script is not completed you will get "no" server response.
– lazyFox
What was the result you expected to achieve with a "timer" on the PHP side ? If the idea is to give some timing to the actions the user does then it’s javascript you want to use.
– Isac
Or use a process in background powered by CRON.
– Woss
Anderson, that would be replace Sleep by usleep, because I saw it on the net, I did it and keep loading endlessly.
– VilmaH