Oihana PHP

max.php

Table of Contents

Functions

max()  : string
Generates the 'max:value' rule expression.

Functions

max()

Generates the 'max:value' rule expression.

max(string|int|float $value) : string

The field under this rule must have a size less than or equal to the given number.

Value size is calculated in the same way as the min rule.

You can also validate the maximum size of uploaded files using this rule:

$validation = $validator->validate
([
   'photo' => $_FILES['photo']
],
[
   'photo' => 'required|max:2M'
]);
Parameters
$value : string|int|float

The maximum size (length, numeric value, or file size such as 2M).

Return values
string

The compiled max:<value> rule expression.

On this page

Search results