I am new to PHP and trying to do programming questions that involve sorting. I want to solve this problem in which the input and output are as followed.
Before Sort: 6Ata7~58jh&*(*HLy^)&a[yjJ>8]G8,$9<Y;B:%^
After Sort: jhytaayjYBJGAHL8968758~&*(*^)&[>],$<;:%^
I need help understanding how to sort according to the order state mention in the title and how I can get the same result from the above input and output. Below is the code I'm working on:
function reverseString($string){
    $stringlen = strlen($string) - 1;
    $split_str = str_split($string, 1);
    $array = array();
    for($i = 0; $i <= $stringlen; $i++){
        array_push($array, $split_str[$i]);
    }
    rsort($array, SORT_STRING | SORT_NUMERIC | SORT_FLAG_CASE | SORT_NATURAL);
    return $array;
}
if(isset($_POST['input']) && !empty($_POST['input'])){
    echo '<pre>';
    echo 'Before sort: ';
    print_r($_POST['input']);
    echo '<br>--------------------<br>';
    echo 'After sort:' ;
    print_r(reverseString($_POST['input'])); 
    echo '</pre>';
}
 
     
    