Sorting data and limiting data in PHP |
Sorting data In PHP, the sort() function is used to sort an indexed array in ascending order and rsort() function is used to sort an indexed array in descending order. Syntax sort(array,sortingtype); Here in the above syntax you have seen different parameters which have been used. Let’s have a look for what purpose they have been used.
Example Sort the elements of the $numbers array in ascending numerical order: <?php Limiting Data In PHP,LIMIT () Function is used to specify the number of records to return. Example If you want to select records from 1 – 40 from a table employees. Then the code will be $sql = “SELECT * FROM employees LIMIT 40”; When the SQL query is run, it will return the first 40 records. |
Tags PHP and MYSQL
Check Also
Copying, Renaming, and Deleting Files
PHP also allows you to copy, rename, and delete files. The functions to perform these …