2015-01-30 09:40:06 +01:00
|
|
|
# In
|
|
|
|
|
2017-03-27 14:47:07 +02:00
|
|
|
- `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
|
2015-10-20 02:53:25 +02:00
|
|
|
v::in('lorem ipsum')->validate('ipsum'); // true
|
2015-01-30 09:40:06 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
For arrays:
|
|
|
|
|
|
|
|
```php
|
2015-10-20 02:53:25 +02:00
|
|
|
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}}`.
|
|
|
|
|
2019-05-11 18:32:13 +02:00
|
|
|
## Categorization
|
|
|
|
|
|
|
|
- Arrays
|
|
|
|
- Comparisons
|
|
|
|
- Strings
|
|
|
|
|
2017-03-27 22:04:13 +02:00
|
|
|
## Changelog
|
|
|
|
|
|
|
|
Version | Description
|
|
|
|
--------|-------------
|
|
|
|
0.3.9 | Created
|
|
|
|
|
2015-08-20 06:38:41 +02:00
|
|
|
***
|
2015-01-30 09:40:06 +01:00
|
|
|
See also:
|
|
|
|
|
2017-03-28 11:53:14 +02:00
|
|
|
- [Contains](Contains.md)
|
2018-12-12 15:12:45 +01:00
|
|
|
- [ContainsAny](ContainsAny.md)
|
2018-12-11 13:31:50 +01:00
|
|
|
- [EndsWith](EndsWith.md)
|
|
|
|
- [Roman](Roman.md)
|
|
|
|
- [StartsWith](StartsWith.md)
|