Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. <?php
  2.  
  3. $allCategories = [
  4. 0 => ["id" => 1, "name" => "Elbise"],
  5. 1 => ["id" => 2, "name" => "Şapka"],
  6. 2 => ["id" => 3, "name" => "Podolski"],
  7. ];
  8.  
  9. $selectedCategories = [
  10. 0 => 1,
  11. 1 => 2
  12. ];
  13.  
  14. foreach ($allCategories as $category) {
  15. $selected = false;
  16. if (in_array($category["id"], $selectedCategories)) {
  17. $selected = true;
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement