4
Is there any native function who identifies How many days is the month?
Example:
Step the value: 2018-08
, then the return would be: 31
.
$dias = funcao('2018-08');
echo $dias; // resultado: 31
If not there is native function, how could you do?
Before you ask: has leap year (February with 29).
The suggestion is good, but to catch the current month, to catch another month and year there would have to use
strtotime
what complicates, but you can adapt as a function.– Guilherme Nascimento