How to Get Max Value an Array in PHP?

03-Apr-2023

.

Admin

How to Get Max Value an Array in PHP?

Hi Dev,

This tutorial will give you an example of how to get the max value of an array in PHP. you can understand the concept of how to get the max value of an array in PHP. step by step explain how to get the maximum value of an array in PHP. this example will help you how to get the max value of a PHP array.

In this tute, we will discuss how to get the max value of an array in PHP. you'll learn how to get the max value of an array in PHP. you can see how to get the maximum value of an array in PHP. Here you will learn how to get the max value of a PHP array. Alright, let’s dive into the steps.

Example 1:


index.php

<?php

echo(max(2,42,60,85,100));

?>

Output:

100

Example 2:

index.php

<?php

echo(max(array(40,13,88,92)));

?>

Output:

92

I hope it could help you...

#PHP