sort()
and rsort()
functionThe PHP sort()
and rsort()
functions can be used for sorting numeric or indexed arrays. The following sections will show you how these functions basically work:
You can use the sort()
function for sorting the numeric array elements or values alphabetically or numerically in the ascending order. Let's try out an example to see how it works:
<?php
$text = array("Sky", "Cloud", "Birds", "Rainbow", "Moon");
$numbers = array(1, 2, 3.5, 5, 8, 10);
// Sorting the array of string
sort($text);
print_r($text);
echo "<br>";
// Sorting the array of numbers
sort($numbers);
print_r($numbers);
?>
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
How to install latest GIMP in Linux
There are many alternatives open-source...How to check if an element is hidden using jQuery
Use the jQuery :hidden Selector The j...How to integrate paypal payment gateway in laravel 5.4
Hello, today laravelcode share with you...How to detect a mobile device in Javascript
In today time, everyone wants to make re...Create custom error page in Laravel 8
Laravel provides with default all errors...