maxWords
Checks if the number of words in the value equals or is below the given maximum
V::maxWords(string|null $value, $max): bool
Parameters
Name | Type | Default |
---|---|---|
$value | string ornull |
no default value |
$maxrequired | mixed |
no default value |
Return type
bool
In your code
if (V::maxWords('Lorem ipsum dolor sit amet.', 10)) {
echo 'Yay, valid!';
}
In fields
fields:
example:
label: Example field
type: text
validate:
maxWords: 10