function AbstractString::indexOf
Parameters
string|string[] $needle:
11 calls to AbstractString::indexOf()
- AbstractString::after in vendor/
symfony/ string/ AbstractString.php - AbstractString::before in vendor/
symfony/ string/ AbstractString.php - AbstractString::containsAny in vendor/
symfony/ string/ AbstractString.php - AbstractString::ensureStart in vendor/
symfony/ string/ AbstractString.php - AbstractString::truncate in vendor/
symfony/ string/ AbstractString.php
3 methods override AbstractString::indexOf()
- ByteString::indexOf in vendor/
symfony/ string/ ByteString.php - CodePointString::indexOf in vendor/
symfony/ string/ CodePointString.php - UnicodeString::indexOf in vendor/
symfony/ string/ UnicodeString.php
File
-
vendor/
symfony/ string/ AbstractString.php, line 340
Class
- AbstractString
- Represents a string of abstract characters.
Namespace
Symfony\Component\StringCode
public function indexOf(string|iterable $needle, int $offset = 0) : ?int {
if (\is_string($needle)) {
throw new \TypeError(\sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
}
$i = \PHP_INT_MAX;
foreach ($needle as $n) {
$j = $this->indexOf((string) $n, $offset);
if (null !== $j && $j < $i) {
$i = $j;
}
}
return \PHP_INT_MAX === $i ? null : $i;
}