PHP performance optimization foreach loop -


i not sure if helpful post full code here or post example, since rather large script, post think necessary components.

i calling txt file , counting each new row array put foreach loop

set_time_limit(0); ini_set('show_errors', 1); $file = "file.txt"; $handle = fopen($file, "r"); while (($name = fgets($handle)) !== false) {     $row = explode ("<br>", $name );     foreach ($row $fname) {         /* ... code ... */     } } 

inside foreach loop have 4 curl operations followed phpexcel functions , else statement contains 4 more curl operations (identical),

what should optimize performance, thinking of either running a) foreach statement shown above in seperate file , using include() rest, or using functions curl operations, interested if else had idea on how improve performance.

since fetching multiple resources curl, if know ahead of time (and don't have download them serially) why not use multi-curl? can fetch resources simultaneously. can either use directly, or use 1 of many classes make easier. https://github.com/jmathai/php-multi-curl


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -