garcon Posted April 10, 2008 Share Posted April 10, 2008 <?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 More sharing options...
craygo Posted April 10, 2008 Share Posted April 10, 2008 what's with the & in front of $rule. &$rule Ray Link to comment https://forums.phpfreaks.com/topic/100530-foreach-is-slow/#findComment-514189 Share on other sites More sharing options...
garcon Posted April 10, 2008 Author Share Posted April 10, 2008 Me being an idiot! The examples in the php.net manual were modifying the array so it was a pointer. I of course don't need this and it appears to have speeded things up a bit. Cheers fella. Link to comment https://forums.phpfreaks.com/topic/100530-foreach-is-slow/#findComment-514206 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.