SHARE
TWEET

PHP Preserves Last Item in Foreach

jayelkaake Feb 16th, 2015 214 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top