mirror of
https://github.com/Respect/Validation.git
synced 2026-03-17 23:59:51 +01:00
38 lines
701 B
Markdown
38 lines
701 B
Markdown
# StartsWith
|
|
|
|
- `StartsWith(mixed $value)`
|
|
- `StartsWith(mixed $value, bool $identical)`
|
|
|
|
This validator is similar to `Contains()`, but validates
|
|
only if the value is at the beginning of the input.
|
|
|
|
For strings:
|
|
|
|
```php
|
|
v::startsWith('lorem')->validate('lorem ipsum'); // true
|
|
```
|
|
|
|
For arrays:
|
|
|
|
```php
|
|
v::startsWith('lorem')->validate(['lorem', 'ipsum']); // true
|
|
```
|
|
|
|
`true` may be passed as a parameter to indicate identical comparison
|
|
instead of equal.
|
|
|
|
Message template for this validator includes `{{startValue}}`.
|
|
|
|
## Changelog
|
|
|
|
Version | Description
|
|
--------|-------------
|
|
0.3.9 | Created
|
|
|
|
***
|
|
See also:
|
|
|
|
- [Contains](Contains.md)
|
|
- [EndsWith](EndsWith.md)
|
|
- [In](In.md)
|
|
- [Regex](Regex.md)
|