Articles → PHP → sort() method in php

sort() method in php






Purpose





Example


$numbers=array(4,6,2,22,11);
echo "Array before sort:";
print_r($numbers);

echo "<br/>";
        
// Sorting an array
sort($numbers);
        
echo "Array after sort:";
print_r($numbers);



Output


Picture showing the output of sort method in php

Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Friday, September 18, 2020

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250