About 514,000 results
Open links in new tab
  1. PHP: max - Manual

    max () returns the parameter value considered "highest" according to standard comparisons. If multiple values of different types evaluate as equal (e.g. 0 and 'abc') the first provided to the function will be returned. If an empty array is passed, max () throws a ValueError.

  2. PHP max() Function - W3Schools

    The max() function returns the highest value in an array, or the highest value of several specified values.

  3. PHP max () Function - GeeksforGeeks

    Sep 10, 2024 · The max() function is an inbuilt function in PHP, used to find the numerically maximum value in an array or the numerically maximum value of several specified values. Syntax max(array_values) or max(value1, value2, ...)

  4. PHP Get Highest Value from Array - Stack Overflow

    Jul 13, 2011 · Don't sort the array to get the largest value. Get the max value: $value = max($array); Get the corresponding key: $key = array_search($value, $array);

  5. How to Find the Largest Element in an Array in PHP?

    Jul 31, 2024 · Below are the approaches to find the largest element in an array in PHP: The max () function is a built-in PHP function that returns the largest value from an array or a set of values. Example: This example shows the use of the above-mentioned approach. Output. $arr is the array containing the elements.

  6. PHP program to find the maximum and the minimum in array

    Aug 20, 2024 · To find the maximum and minimum values in an array using sort () and rsort (), first, make copies of the array. Then, sort one in ascending order with `sort ()` to find the minimum, and the other in descending order with rsort () to find the maximum. Example:

  7. PHP | Math Functions | max() | Codecademy

    Jun 2, 2023 · The max() function in PHP is used to find the highest value in an array or a list of variables. It returns the highest value from the input provided. Syntax max($var1, $var2, $var3, ...); $var1, $var2, $var3 are the variables from which the maximum value will be returned.

  8. PHP: max() function - w3resource

    Aug 19, 2022 · The max () function is used to find the highest value from a set of expression. Version: (PHP 4 and above) Syntax: max(num1, num2, num3...) If the first and only parameter is an array, it returns the highest value in that array. Parameters: Specified array. Specified numbers (at least two numbers). Return value:

  9. PHP to find the maximum value in an array - Amazing Algorithms

    The max() function is used to find the maximum value in the array. It takes an array as an argument and returns the largest value in the array. In our case, max($numbers) returns 5, which is the maximum value in the array. Printing the Maximum Value: The echo statement is used to print the maximum value stored in the $max_value variable. The ...

  10. How to find the maximum value in an array in PHP?

    Jan 23, 2024 · By leveraging PHP’s built-in functions and employing iterative approaches, you can simplify the process of finding the maximum value in an array. We will explore methods such as utilizing the max() function, manually iterating through the array, and employing the array_reduce() function.

  11. Some results have been removed
Refresh