I'd like to know whether it is possible to have PHP run commands on a set loop, without the need of a user to be actively viewing it on a browser.
For example, mail sending - I'd like to be able to have this loop run, even when I close the browser, until I command it to stop.
$name = "Foo";
$to = $row['email'] //imagine it was fetched from a database;
mail($to,"Hello ".$name."! you won a million dollars!","Just kidding!");
After looking it up, I've noticed that some people mentioned it is possible to run PHP scripts as processes, I'd love to know if such a thing can be done, and if so I'd appreciate any help regarding the case
Thanks in advance!