He said he needed it as part of the script, so I was assuming he did not want to reload a page every time. So I guess it depends on what he's trying to achieve, but one or the other of those should do it.
What I was trying to do is have a function repeat itself every 10s - but all the code required in the script (e.g. without cron or a browser). The sleep() function will work great. thanks for all your help