Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $allCategories = [
- 0 => ["id" => 1, "name" => "Elbise"],
- 1 => ["id" => 2, "name" => "Şapka"],
- 2 => ["id" => 3, "name" => "Podolski"],
- ];
- $selectedCategories = [
- 0 => 1,
- 1 => 2
- ];
- foreach ($allCategories as $category) {
- $selected = false;
- if (in_array($category["id"], $selectedCategories)) {
- $selected = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement