44 of 410 menu

The max Function

The max function finds the largest number among the parameters passed to it or the largest number among the elements of an array.

Syntax

max(first number, second number...);
max(array of numbers);

Example

Let's find the largest among the given numbers:

<?php echo max(1, 2, 3); ?>

The code execution result:

3

Example

Let's find the largest value in the array:

<?php echo max([1, 2, 3]); ?>

The code execution result:

3

See Also

  • the min function,
    which finds the smallest number
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline