The Techjoomla Blog

Stay updated with all the latest happenings at Techjoomla. From news about the developments in your favourite extensions to Tips & Tricks about the Joomla CMS, Framework & Development.

Beware of these mistakes while coding in PHP-Part 2

Beware-of-these-mistakes-while-coding-in-PHP

Mistake 2: Forgetting to unset the reference variable after the loop.

In the previous blog of the series we started with the isset function mistake and I have promised to post about the next mistake which is leaving dangling array references after foreach loop.

While working with arrays, we need foreach to iterate over arrays. In some case, we might be just displaying each array element while iterations but in some case, we might need to manipulate or operate on each element. When there is a case, where we need to operate on each element, using references in foreach loops can be useful. See below code snippet.

Continue reading
0
  1435 Hits
  0 Comments
1435 Hits
0 Comments