Advertisement
jayelkaake

PHP Preserves Last Item in Foreach

Feb 16th, 2015
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.24 KB | None | 0 0
  1.     foreach($companies as $company) {
  2.         if(isset($app)) {
  3.             $apps = array($app);
  4.         } else {
  5.             $apps = $company->getAllApps();
  6.         }
  7.         foreach($apps as $app) {
  8.         // Do some stuff.
  9.         }
  10.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement