Jump to content

foreach is slow?


garcon

Recommended Posts

<?php
$rules_list = explode("*",$venue->rules); 
echo "<ul class=\"venue_rules\">";
foreach($rules_list as &$rule) {
    echo "<li>$rule</li>";
}
echo "</ul>";
?>

 

This seems to be slow - the page takes a noticeable couple of seconds to load when testing it on my PC since I added it. I think maybe that is not the correct use of foreach and there's a quicker way to do the same thing? Can anyone point me in the right direction? Cheers.

Link to comment
https://forums.phpfreaks.com/topic/100530-foreach-is-slow/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.