D
D
Dmitry2016-07-17 13:51:27
CMS
Dmitry, 2016-07-17 13:51:27

How to set a limit?

How to make a restriction so that when entering you can enter a number from 1-31, but if the number 0 is entered, then an error was displayedf059ee42c941441b83bfa3e1a92b2c05.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Taratin, 2016-07-17
@Taraflex

$year = $intval($year);
return $year > 0 && $year <=31;

I
index0h, 2016-07-18
@index0h

Assert::assert($year, 'year')->int()->between(1, 31);

Link to the library
My advice to you: forget about the existence of errors, only exceptions, it will wildly simplify your life.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question