<?php $lookup = [ 'foo' => 1, 'bar' => 2, 'baz' => 3, 'fizz' => 4, 'buzz' => 5, ]; $array = ['buzz', 'foo', 'baz']; usort($array, fn($a, $b) => $lookup[$a] <=> $lookup[$b]); var_export($array);
You have javascript disabled. You will not be able to edit any code.