Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Find min and max from associative array in PHP

<?php
	$items = [
	['emp_id' => '1', 'name' => 'ram', 'age' => 40],
	['emp_id' => '5', 'name' => 'ram_1', 'age' => 20],
	['emp_id' => '2', 'name' => 'ram_2', 'age' => 30],
	['emp_id' => '3', 'name' => 'ram_4', 'age' => 25],
	['emp_id' => '4', 'name' => 'ram_3', 'age' => 50]

];
// please find minimum age employee in above array.
echo  min(array_column($items, 'age'));
echo  max(array_column($items, 'age'));
?>
Comment

get min value from array php

The min() function returns the lowest value in an array
exemple :
echo(min(array(44,16,81,12)));
Comment

PREVIOUS NEXT
Code Example
Php :: show woocommerce product variation in table php 
Php :: eloquent get record older than 2 days 
Php :: is replace case sensitive php 
Php :: laravel set field unique 
Php :: ini_set php 
Php :: how to make arrays in php 
Php :: cambiare pagina php 
Php :: Generate Unique Random String With Any Character Size | unique random php generator | php unique id generator 
Php :: how to show image in laravel 
Php :: create multiple session in php 
Php :: how to write tests for php 
Php :: generate random string in php 
Php :: get node id in twig drupal 
Php :: laravel @disabled in laravel-9 
Php :: Termlaravel validation exists array data 
Php :: html to pdf in php 
Php :: create email template php 
Php :: laravel 8 register with email verification 
Php :: wordpress remove taxonomy from post 
Php :: php unique associative nested array by value 
Php :: office 2013 
Php :: php artisan tinker encription cmd 
Php :: https://www.60d48b1061adf.site123/wp-login.php 
Php :: phpunit test private function 
Php :: get joomla group ids 
Php :: laravel trans with parameters 
Php :: php call constant in class 
Php :: laravel search multiple tables 
Php :: get current locale laravel 
Php :: php != operator 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =