2015-01-30 09:40:06 +01:00
|
|
|
# Contains
|
|
|
|
|
2017-03-27 14:47:07 +02:00
|
|
|
- `Contains(mixed $value)`
|
|
|
|
- `Contains(mixed $value, bool $identical)`
|
2015-01-30 09:40:06 +01:00
|
|
|
|
|
|
|
For strings:
|
|
|
|
|
|
|
|
```php
|
2015-10-20 02:53:25 +02:00
|
|
|
v::contains('ipsum')->validate('lorem ipsum'); // true
|
2015-01-30 09:40:06 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
For arrays:
|
|
|
|
|
|
|
|
```php
|
2015-10-20 02:53:25 +02:00
|
|
|
v::contains('ipsum')->validate(['ipsum', '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 `{{containsValue}}`.
|
|
|
|
|
2015-08-20 06:38:41 +02:00
|
|
|
***
|
2015-01-30 09:40:06 +01:00
|
|
|
See also:
|
|
|
|
|
|
|
|
* [StartsWith](StartsWith.md)
|
|
|
|
* [EndsWith](EndsWith.md)
|
|
|
|
* [In](In.md)
|