45 of 410 menu

The min Function

The min function finds the smallest number from the parameters passed to it or the smallest number among the elements of an array.

Syntax

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

Example

Let's find the smallest among the given numbers:

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

Code execution result:

1

Example

Let's find the smallest value in the array:

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

Code execution result:

1

See Also

  • the max function,
    which finds the largest number
byenru