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
    • 150
    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.

    1. <?php
    2.  
    3. $Getage=array("Joe"=>"28","Anthony"=>"35","Tori"=>"45");
    4.  
    5. //now call the asort() function for sorting associative array
    6. arsort($Getage);
    7.  
    8. ////loop rstart for find all value
    9. foreach($Getage as $key=>$value)
    10. {
    11. echo "Name=" . $key . ", Age=" . $value;
    12. echo "<br>";
    13. }
    14. ?>

    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
Reset Password
Fill out the form below and reset your password: