Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use arsort() function in php ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 119
    Comment on it

    What is tht arsort() function in php ?

    The arsort() function sorts an associative array in descending order, as reported by the value.

    why use arsort() function in php ?

    arsort() is fundamentally used when sorting associative array in descending order, according to the value..

    You can see below example of arsort() function in php.

    <?php
    
    $Getage=array("Joe"=>"28","Anthony"=>"35","Tori"=>"45");
    
    //now call the asort() function for sorting associative array 
    arsort($Getage);
    
    ////loop rstart for find all value
    foreach($Getage as $key=>$value)
        {
        echo "Name=" . $key . ", Age=" . $value;
        echo "<br>";
        }
    ?>
    

    Output will come

    Name=Tori, Age=45

    Name=Anthony, Age=35

    Name=Joe, Age=28

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: