Prioritizing the most important value in an array
In most circumstances it is better to do sorting in your SQL layer

&lt;?php
$sorted_data = $data;
$importance = array_flip(['Jack', 'Bob', 'Boris', 'Josh']);
usort($sorted_data, function ($a, $b) use ($importance) {
  return $importance[$a] &lt;=&gt; $importance[$b];
});
$important_person = reset($sorted_data);


If you need to reuse your code then I suggest: 

&lt;?php
function sort_users(array $importance) : Closure {
  return function (string $user_a, string $user_b) use ($importance) : int {
      $a_priority = $importance[$user_a] ?? 0;
      $b_priority = $importance[$user_b] ?? 0;
      return $a_priority &lt;=&gt; $b_priority;
  };
}

$sorted_data = $data;
$importance = array_flip(['Jack', 'Bob', 'Boris', 'Josh']);
usort($sorted_data, sort_users($importance));
$important_person = reset($sorted_data);


Some of the above code can be removed if you can sort the original array, and if $data always contains elements of $importance 

I would suggest thinking of a better variable name for $data because it's not obvious what data is, is $first_names better?