top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What are the different functinos used for sorting an array ?

+1 vote
272 views
What are the different functinos used for sorting an array ?
posted Jun 2, 2014 by Amanpreet Kaur

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

0 votes

sort() - sort arrays in ascending order
rsort() - sort arrays in descending order
asort() - sort associative arrays in ascending order, according to the value
ksort() - sort associative arrays in ascending order, according to the key
arsort() - sort associative arrays in descending order, according to the value
krsort() - sort associative arrays in descending order, according to the key

answer Jun 3, 2014 by Vrije Mani Upadhyay
0 votes

Following functions can be used for sorting an Array.
1. sort()
2. arsort()
3. asort()
4. ksort()
5. natcasesort()
6. rsort()
7. usort()
8.array_multisort()
9. uksort()

answer Jun 3, 2014 by Mohit Sharma
Similar Questions
0 votes
for($i=0;$i<=feof($getdata);$i++)
{
if (filter_var($data[$i][1], FILTER_VALIDATE_EMAIL)){
echo $data[$i][1];
$email=$data[$i][1];
$conn = mysqli_connect($dbhost,$dbuser,$dbpass, $dbname);
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}
$sql ="INSERT INTO promo_user (uid,name,email) VALUES (,'', '$email')";
mysqli_query($sql,$conn);
mysqli_close($conn);

I am using the above code but there is something wrong with it,whenever i run the code the echo is working fine but the content does go into sql table

Please help

...