PHP: krsort() function
PHP: Sort an array by key in reverse order
The krsort() function is used to sort an array by key in reverse order. Sorts an array by key in reverse order, maintaining a key to data correlations. The function is useful mainly for associative arrays.
(PHP 4 and above)
|array_name||The argument to process in radians.||Required||Array|
|sort_type||Sets the sorting behavior. Possible Sorting type flags.
SORT_REGULAR - Compare items normally.
SORT_NUMERIC - Compare items numerically.
SORT_STRING - Compare items as strings.
SORT_LOCALE_STRING - compare items as strings, based on the current locale
TRUE on success or FALSE on failure.
Value Type: Boolean.
<?php $w3r_array = array("x" => "html", "y" => "xhtml", "z" => "xml"); krsort($w3r_array); print_r($w3r_array); ?>
Array ([z] => xml [y] => xhtml [x] => html)
Practice here online:
PHP: Tips of the Day
PHP: How to generate a random, unique, alphanumeric string for use in a secret link?
Security Notice: This solution should not be used in situations where the quality of your randomness can affect the security of an application. In particular, rand() and uniqid() are not cryptographically secure random number generators. See Scott's answer for a secure alternative.
If you do not need it to be absolutely unique over time:
Otherwise (given you have already determined a unique login for your user):
Ref : https://bit.ly/31fd9wa
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook