respect-validation/docs/Contains.md

37 lines
635 B
Markdown
Raw Normal View History

2015-01-30 09:40:06 +01:00
# Contains
- `Contains(mixed $expectedValue)`
- `Contains(mixed $expectedValue, bool $identical)`
Validates if the input contains some value.
2015-01-30 09:40:06 +01:00
For strings:
```php
v::contains('ipsum')->validate('lorem ipsum'); // true
2015-01-30 09:40:06 +01:00
```
For arrays:
```php
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}}`.
## Changelog
Version | Description
--------|-------------
0.3.9 | Created
***
2015-01-30 09:40:06 +01:00
See also:
* [StartsWith](StartsWith.md)
* [EndsWith](EndsWith.md)
* [In](In.md)