Answer the question
In order to leave comments, you need to log in
How to go through the loop so that there are no duplicate elements?
Hello, I'm scratching my head, I can not solve the problem. Help me please.
There is an array with available countries:
array(
(int) 0 => array(
'countries_users' => array(
'id' => '1',
'country_id' => '244',
'user_id' => '6'
)
),
(int) 1 => array(
'countries_users' => array(
'id' => '2',
'country_id' => '132',
'user_id' => '6'
)
)
)
array(
(int) 0 => array(
'Country' => array(
'id' => '132',
'country_code' => 'MW',
'country_name' => 'Malawi',
'show_in_documents' => true
)
),
(int) 1 => array(
'Country' => array(
'id' => '152',
'country_code' => 'NA',
'country_name' => 'Namibia',
'show_in_documents' => true
)
),
(int) 2 => array(
'Country' => array(
'id' => '200',
'country_code' => 'ZA',
'country_name' => 'South Africa',
'show_in_documents' => true
)
),
(int) 3 => array(
'Country' => array(
'id' => '215',
'country_code' => 'TZ',
'country_name' => 'Tanzania, United Republic of',
'show_in_documents' => true
)
),
(int) 4 => array(
'Country' => array(
'id' => '244',
'country_code' => 'ZM',
'country_name' => 'Zambia',
'show_in_documents' => true
)
)
)
<input type="checkbox">
countries_users['country_id'] == country['id']are equal, then put checked. When I try, the countries start to duplicate.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question