Advertisement
kudrmichal

Untitled

Feb 18th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.33 KB | None | 0 0
  1. $type1 = $type2 = $type3 = NULL;
  2.  
  3. while($entity = array_shift($collection)) {
  4.     if ($type1 && $type2 && $type3) {
  5.         break;
  6.     }
  7.  
  8.     if (!$type1 && $entity->type = 1) {
  9.         $type1 = $entity;
  10.     }
  11.     else if (!$type2 && $entity->type = 2) {
  12.         $type2 = $entity;
  13.     } else if (!$type3 && $entity->type = 3) {
  14.         $type3 = $entity;
  15.     }
  16.    
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement