in
Determine if the string exists in another string.
php
Twine\Str::in( string $string [ , string $mode = Twine\Config\In::CASE_SENSITIVE ] ) : boolParameters
$string
The string to compare against.
$mode
A mode flag for case-sensitive and case-insensitive matching.
Available in mode flags:
Twine\Config\In::CASE_SENSITIVE: Match the string with case sensitivity (default)Twine\Config\In::CASE_INSENSITIVE: Match the string with case insensitivity
Examples
php
$string = new Twine\Str('pink');
$string->in('john pinkerton'); // Returns truephp
$string = new Twine\Str('purple');
$string->in('john pinkerton'); // Returns falsephp
$string = new Twine\Str('Pink');
$string->in('john pinkerton', Twine\Config\In::CASE_INSENSITIVE); // Returns truephp
$color = new Twine\Str('pink');
$name = new Twine\Str('john pinkerton');
$color->in($name); // Returns true