PHP

Paralel Process In PHP

In my own experience, paralelizing process in PHP is alot efficient. Not saving your time, but it will save memory usage.

I use paralel method when working with several task at once. For example, fetching several RSS feeds. Let’s give it a try.

Sample case, we must fetch data from 5 (five) rss feeds.

< ?php // call this run.php $feeds = array( "https://feeds.com/feed1.xml", "https://feeds.com/feed2.xml", "https://feeds.com/feed3.xml", "https://feeds.com/feed4.xml", "https://feeds.com/feed5.xml" ); foreach($feeds as $feed){ exec("php.exe fetcher.php?url=$feed"); } ?>

Well, that’s jus’t a simple illustration. Not so good, I think 😛

I’ve written more complex task using paralel method for my web crawler and it works as beast!

Leave a Reply