1

I have the following code:

<?php $allCheckbox = get_field('sensor_types'); //Checked value from backend

$field_key = "field_60e546d470762"; //Get value using key
$post_id = get_the_ID();
$field = get_field_object($field_key, $post_id);?>
<?php foreach($field['choices'] as $lab => $val){ 
if(in_array($val, $allCheckbox)){
    $enable = 'Yes';       
} else {
    $enable = 'No';
}?>

<div class="ct-div-block d-data-block c-columns-2-3">
<div class="ct-div-block"><?php echo $val; ?></div>
    <div class="ct-div-block"><?php echo $enable ?></div>
</div>
<div class="d-seperator"></div>
<?php } ?>

I want to sort out the output to alphabetical order but as there is two output $val and $enable I am at confusion as to how i can use the Sort Function to solve this issue. The sort is dependent on $enable that is the ones with yes will come first then the ones with no

0 Answers0