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

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 144
    Comment on it

    What is tht sort() function in php ?

    The sort() function sorts an indexed array in ascending order means lowest to highest .

    why use sort() function in php ?

    Sort() function basically use for sort the elements of the array in ascending alphabetical order:

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

    <?php
    
    $Name=array("Sanny","Mac","Brandam");
    //here $Name is a variable
    sort($Name);
    //now call the sort() for sorting name in alphabetical order
    
    //loop start for count name
    for($i=0;$i<count($Name);$i++)
       {
         echo $Name[$i];
          echo "<br>";
       }
    ?>
    

    output will come following:

    Brandam

    Mac

    Sanny

 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: