How to get minimum key value of array in PHP?By Hardik Savani | February 12, 2016 | | 923 Viewer | Category : PHP
Sometimes, you need to get minimum key value of your array but you try to get with loop and any function etc, but in bellow example you can see we can get smallest key value from our php array by using min() and array_keys(). So, let's try to use in your code this way:
$myArray = ['2'=>'Hey','4'=>'Hello','1'=>'Hi','3'=>'GH'];
$new_key = min(array_keys($myArray));
$new_val = $myArray[$new_key];
- Codeigniter 3 - select2 ajax autocomplete from database example with demo
- How to increase throttle lockout time and max Login Attempts in Laravel 5?
- Full Text Search in Laravel 5 Example
- Codeigniter JQuery Ajax image upload example from scratch
- How to increment or decrement a column value in laravel?
- How to create laravel 5 widgets ?
- Laravel 5 clear cache from route, view, config and all cache data from application
- AngularJS - How to call function on page load example with demo?