Although it is perfectly legal in PHP to use the same variable as the array and the individual value of a foreach loop. 1 major downside is that it then breaks that array for use further down the page.
I suppose it's not often that you'd use it multiple times in one page. Though one example would be pagination for example. Having it on top and bottom of a page for convenience, if you did foreach ($pages as $pages) then you wouldn't be able to use it after that.
Wouldn't it be best to always be sure to use foreach($pages as $page) ?
Why would you ever want to to use something like
It doesn't make sense at all to me!
Code: Select all
foreach ($pages as $pages)
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
I don't. It was something Daniel used in 0.x that I changed... but I am seeing he uses it in 1.x now as well. So I was wondering why.
Take a look at any file in catalog/view/theme/default/template/product/*.tpl
They all have
Take a look at any file in catalog/view/theme/default/template/product/*.tpl
They all have
Code: Select all
foreach ($sorts as $sorts) {
Who is online
Users browsing this forum: No registered users and 7 guests