How to use acf field value to order category?

Use this code.

$categories = get_terms('toc_category');
$sorted_cats = array();
foreach($categories as $cat){
    $ordr = get_field('order', 'toc_category_'.$cat->term_id);
    $sorted_cats[$ordr] = $cat->name;
}
krsort($sorted_cats);
return $sorted_cats;

tech