Refresh page X times and then stop using PHP

Is there a way of doing this in php (not javascript, not jquery)? I need to refresh a page X number of times and then stop. Can't find anything working online. I do not want to use header('Refresh: 5; URL=someurl.com'); unless there's a way to stop it from looping after a few times.

I'd appreciate if nobody asks me why I need it. It doesn't matter. I just need it.

from PHP http://ift.tt/1pWpTlo
via IFTTT
Previous
Next Post »
Thanks for your comment