Lines Matching refs:needle

115  * @param string $needle The string to find in $haystack.
120 public static function stripos($haystack, $needle, $offset = 0) { argument
123 $needle = Multibyte::strtoupper($needle);
124 return Multibyte::strpos($haystack, $needle, $offset);
126 return stripos($haystack, $needle, $offset);
133 * @param string $needle The string to find in $haystack.
140 public static function stristr($haystack, $needle, $part = false) { argument
151 $needle = Multibyte::strtoupper($needle);
152 $needle = Multibyte::utf8($needle);
153 $needleCount = count($needle);
159 if (isset($needle[0]) && $needle[0] === $check[$position]) {
161 if ($needle[$i] !== $check[$position + $i]) {
185 return stristr($haystack, $needle, $part);
187 return stristr($haystack, $needle);
208 * @param string $needle The position counted from the beginning of haystack.
213 public static function strpos($haystack, $needle, $offset = 0) { argument
220 $needle = Multibyte::utf8($needle);
221 $needleCount = count($needle);
226 if (isset($needle[0]) && $needle[0] === $haystack[$position]) {
228 if ($needle[$i] !== $haystack[$position + $i]) {
244 return strpos($haystack, $needle, $offset);
251 * @param string $needle The string to find in $haystack.
258 public static function strrchr($haystack, $needle, $part = false) { argument
267 $needle = Multibyte::utf8($needle);
268 $needleCount = count($needle);
274 if (isset($needle[0]) && $needle[0] === $check[$position]) {
276 if ($needle[$i] !== $check[$position + $i]) {
277 if ($needle[$i] === $check[($position + $i) - 1]) {
285 if (isset($matches[$needle[0]]) && $matches[$needle[0]] > 1) {
286 $matches[$needle[0]] = $matches[$needle[0]] - 1;
311 * @param string $needle The string to find in $haystack.
318 public static function strrichr($haystack, $needle, $part = false) { argument
328 $needle = Multibyte::strtoupper($needle);
329 $needle = Multibyte::utf8($needle);
330 $needleCount = count($needle);
336 if (isset($needle[0]) && $needle[0] === $check[$position]) {
338 if ($needle[$i] !== $check[$position + $i]) {
339 if ($needle[$i] === $check[($position + $i) - 1]) {
347 if (isset($matches[$needle[0]]) && $matches[$needle[0]] > 1) {
348 $matches[$needle[0]] = $matches[$needle[0]] - 1;
373 * @param string $needle The string to find in $haystack.
378 public static function strripos($haystack, $needle, $offset = 0) { argument
387 $needle = Multibyte::strtoupper($needle);
388 $needle = Multibyte::utf8($needle);
389 $needleCount = count($needle);
394 if (isset($needle[0]) && $needle[0] === $haystack[$position]) {
396 if ($needle[$i] !== $haystack[$position + $i]) {
397 if ($needle[$i] === $haystack[($position + $i) - 1]) {
405 if (!$offset && isset($matches[$needle[0]]) && $matches[$needle[0]] > 1) {
406 $matches[$needle[0]] = $matches[$needle[0]] - 1;
416 return strripos($haystack, $needle, $offset);
423 * @param string $needle The string to find in $haystack.
429 public static function strrpos($haystack, $needle, $offset = 0) { argument
438 $needle = Multibyte::utf8($needle);
439 $needleCount = count($needle);
444 if (isset($needle[0]) && $needle[0] === $haystack[$position]) {
446 if ($needle[$i] !== $haystack[$position + $i]) {
447 if ($needle[$i] === $haystack[($position + $i) - 1]) {
455 if (!$offset && isset($matches[$needle[0]]) && $matches[$needle[0]] > 1) {
456 $matches[$needle[0]] = $matches[$needle[0]] - 1;
466 return strrpos($haystack, $needle, $offset);
473 * @param string $needle The string to find in $haystack
480 public static function strstr($haystack, $needle, $part = false) { argument
490 $needle = Multibyte::utf8($needle);
491 $needleCount = count($needle);
497 if (isset($needle[0]) && $needle[0] === $check[$position]) {
499 if ($needle[$i] !== $check[$position + $i]) {
523 return strstr($haystack, $needle, $part);
525 return strstr($haystack, $needle);
664 * @param string $needle The string being found.
667 public static function substrCount($haystack, $needle) { argument
672 $needle = Multibyte::utf8($needle);
673 $needleCount = count($needle);
675 if ($needleCount === 1 && isset($matches[$needle[0]])) {
676 return $matches[$needle[0]];
680 if (isset($needle[0]) && $needle[0] === $haystack[$i]) {
682 if ($needle[$ii] === $haystack[$i + 1]) {
683 … if ((isset($needle[$ii + 1]) && $haystack[$i + 2]) && $needle[$ii + 1] !== $haystack[$i + 2]) {