<?php $data = ['_', '@', ...range(-10, 10), ...range('A', 'F'), ...range('a', 'f') ]; usort( $data, fn($a, $b) => ($b < 0 <=> $a < 0) // prioritize negatives ?: (is_int($a) <=> is_int($b)) // deprioritize integers ?: (ltrim($a, 'A..Z') <=> ltrim($b, 'A..Z')) // prioritize uppercase letters ?: ($a <=> $b) // sort normally ); var_export($data);
You have javascript disabled. You will not be able to edit any code.