public static function Unicode::strpos in Drupal 8
Finds the position of the first occurrence of a string in another string.
Parameters
string $haystack: The string to search in.
string $needle: The string to find in $haystack.
int $offset: If specified, start the search at this number of characters from the beginning (default 0).
Return value
int|false The position where $needle occurs in $haystack, always relative to the beginning (independent of $offset), or FALSE if not found. Note that a return value of 0 is not the same as FALSE.
Deprecated
in drupal:8.6.0 and is removed from drupal:9.0.0. Use mb_strpos() instead.
See also
https://www.drupal.org/node/2850048
1 call to Unicode::strpos()
- UnicodeTest::testStrpos in core/
tests/ Drupal/ Tests/ Component/ Utility/ UnicodeTest.php - Tests multibyte strpos.
File
- core/
lib/ Drupal/ Component/ Utility/ Unicode.php, line 626
Class
- Unicode
- Provides Unicode-related conversions and operations.
Namespace
Drupal\Component\UtilityCode
public static function strpos($haystack, $needle, $offset = 0) {
@trigger_error('\\Drupal\\Component\\Utility\\Unicode::strpos() is deprecated in Drupal 8.6.0 and will be removed before Drupal 9.0.0. Use mb_strpos() instead. See https://www.drupal.org/node/2850048.', E_USER_DEPRECATED);
return mb_strpos($haystack, $needle, $offset);
}