- var_export: documentation ( source)
- array_flip: documentation ( source)
- usort: documentation ( source)
<?php
$array = ['val1', 'val2', 200, 179, 230, 234, 242];
$order = [230, 234, 242, 179, 100];
$keyedOrder = array_flip($order); // for efficiency
usort($array, fn($a, $b) => [$keyedOrder[$a] ?? -1, $a] <=> [$keyedOrder[$b] ?? -1, $b]);
var_export($array);