respect-validation/docs/rules/In.md

45 lines
717 B
Markdown
Raw Normal View History

2015-01-30 09:40:06 +01:00
# In
- `In(mixed $haystack)`
- `In(mixed $haystack, bool $identical)`
2015-01-30 09:40:06 +01:00
Validates if the input is contained in a specific haystack.
For strings:
```php
v::in('lorem ipsum')->validate('ipsum'); // true
2015-01-30 09:40:06 +01:00
```
For arrays:
```php
v::in(['lorem', 'ipsum'])->validate('lorem'); // true
2015-01-30 09:40:06 +01:00
```
A second parameter may be passed for identical comparison instead
of equal comparison.
Message template for this validator includes `{{haystack}}`.
## Categorization
- Arrays
- Comparisons
- Strings
## Changelog
Version | Description
--------|-------------
0.3.9 | Created
***
2015-01-30 09:40:06 +01:00
See also:
- [Contains](Contains.md)
- [ContainsAny](ContainsAny.md)
2018-12-11 13:31:50 +01:00
- [EndsWith](EndsWith.md)
- [Roman](Roman.md)
- [StartsWith](StartsWith.md)