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

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 103
    Comment on it

    What is tht asort() function in php ?

    The asort() function sorts an associative array in ascending order as reported by the value.

    why use asort() function in php ?

    asort() is fundamentally used when sorting associative array where the authentic element order is paramount.

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

    <?php
    
    $employeage=array("Samir"=>"25","Bhuvi"=>"30","Ankit"=>"43");
    
    //now call the asort() function for sorting associative array 
    asort($employeage);
    
    ////loop rstart for find all value
    foreach($employeage as $key=>$value)
        {
        echo "Name=" . $key . ", Age=" . $value;
        echo "<br>";
        }
    ?>
    

    Output will come

    Name=Samir, Age=25

    Name=Bhuvi, Age=30

    Name=Ankit, Age=43

 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: