I have to compare dropdown with multiple array, my first array is
[menu_master] => Array
(
[master/city] => City
[master/national_holiday] => National Holiday
[master/operator_comments] => Operator Comments
[master/sensors] => Sensors
[master/modbus] => Modbus
[master/manufacturers] => Manufacturers
[master/make_model] => Make Model
)
my second array is
[role_assign] => Array
(
[1] => View
[2] => Write
)
And my third array is come form database
[database_fetch] => Array
(
[master/city] => 1
[master/national_holiday] => 2
[master/operator_comments] => 1
[master/sensors] => 2
[master/modbus] => 1
[master/manufacturers] => 2
[master/make_model] => 1
)
Now these array apply to below code. I want show selected option of dropdown which comes form database fetch array.
<?php
$menu_manster = menu_master();
$i = 1;
foreach($menu_manster as $k => $val) {
?>
<tr>
<td>{{ $i }}</td>
<td class="mailbox-name">{{ $val }}</td>
<td><?php $roles_assign = roles_assign_id(); ?>
<select class="form-control master-menu" name="master_menu[{{$k}}]">
<option value="">Select Role</option>
<?php
foreach ($roles_assign as $key => $value) {
?>
<option value="<?php echo $key; ?>"><?php echo $value; ?></option>
<?php } ?>
</select>
</td>
</tr>
<?php $i++; } ?>