将数组传递给新的php脚本或执行相同的函数(执行时间)

I am currently working on a project with some more data than in other projects. I filter different rss-feeds and save them in our database (we already contacted the authors and they are okay with that ;) ). We already gathered some data and the script takes about 8 to 10 seconds to finish. The script is called by a cron-job every 5 Minutes. The articles from the feeds are about different artists, and the system checks which artists it is.

Now we want to add a system, where the user can subscribe to different artists and gets an email when a new article is saved in the database. So my idea was to simply pass the id's from the articles that are new to a new function where we handle the Sending of the Mails.

Now I am afraid that the execution time gets to high if we get more and more data. So I have two questions: How do you get the time for the execution time of the php script? Is it the time the server needs to execute the whole php file or the different single functions?

I thought it's maybe better to pass the id's to a new file an execute a new script, so the execution time does not get to high. If so, which is the best way to pass the data to a new file and execute the script.

Any help would be appreciated

The new file concept is best suite in your application. We able to pass separate id's on every time to separate page and we can get result easily.

So, we can use Ajax and we can show loader icon up to result comes.

Get the time in unix time stamp at the very top of the script right after the php open tag by calling date("U"); and then call it again at the very end of your script when you are doing whatever your script does. You can now subtract the first timestamp from the second and you are left with the execution time in seconds. Look at http://php.net/manual/en/function.date.php if you want to get a more fine-tuned execution time and use microseconds or the like.

If it is a very short running script, you can use microtime instead of date: http://php.net/manual/en/function.microtime.php