answersLogoWhite

0


Best Answer

sort() will order the array by its values without preserving the keys. Use it when array is indexed numerically or when you do not care about the keys.

asort() will also sort the array by its values, but it will preserve the key -> value association.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between sort and asort in PHP?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Difference between apache and PHP?

Apache is a web server. PHP is a scripting language.


What is a PHP certificate?

PHP certification is received after doing some sort of PHP course, there are many out there to do. You can use them in your CV to help you get a job in PHP.


What is the difference between PHP and struts?

STRUTs is a framework of technology of java based on JSP/Java Servlets PHP is another server scripting language


How do you sort variable in ascending or descending order both in php?

Assuming that the values are stored in an array, you can use the php function sort($array) to sort ascending, and rsort to sort descending. The following link gives a table that lists all of the built in PHP sort functions: http://php.net/manual/en/array.sorting.php


What is the difference between net and php?

.net is a framework based on Microsoft software and is not open source, php is a language which is open source and based on Linux/unix systems


Difference between jsp and php?

JSP stands for Java Server Pages whereas PHP stands for Hypertext PreProcessor. PHP is a scripting language whereas JSP is a full fledged technology. JSP is much more powerful and has more features than PHP


What is the difference between the 1982 Large Digit and Small Digit pennies?

http://www.thecentproject.com/sort1982.php


What is the difference between single quotes and double quotes?

in programming, single quotes are for characters, and double quotes are for string, but in php, javascript, html, css i don't see any difference between the two.


What is the difference between PHP and JSP?

They are different technologies - JSP stands for Java Server Pages, where PHP means PHP: Hypertext Preprocessor... Basically, they do the same thing - generate webpages, but JSP scripts are programmed in Java, and PHP scripts in PHP, which are completely different scripting languages. PHP is usually used in small to medium-sized projects, where Java tends to be percieved as a more "enterprisey" (aimed at large projects).


What is difference between php and ruby?

One major difference between those two is the amount of time it takes to learn and install them. PHP seems fairy easy to comprehend for beginners and you just need a XAMPP/WAMP/LAMP server to run PHP while Ruby is a bit difficult.Ruby allows Java in backend so that means you can have some features like threading which are not that well supported in PHP.PHP is a bit faster then RubyCode for Ruby on Rails is quite less compared to PHP which requires a lot of coding


What is the difference between single quotes and double quotes in PHP?

There's not too much of a difference. Most people prefer using double quotes because of the fact that you can do this: <?php $var2 = "Look at {$var1}!"; ?> which you can't do the {} thing with single quotes. You would have to do <?php $var = 'Look at '.$var1.'!'; ?>


What is the difference between PHP4 and PHP5?

they are the same, but php 5 has improvements in design, security, and stablity. it is basically a new version. if you want more details just go to http://www.php.net and find the recent changes in php.