|
@@ -340,13 +340,18 @@ function ends_with($haystack, $needle)
|
|
/**
|
|
/**
|
|
* Determine if a given string contains a given sub-string.
|
|
* Determine if a given string contains a given sub-string.
|
|
*
|
|
*
|
|
- * @param string $haystack
|
|
|
|
- * @param string $needle
|
|
|
|
|
|
+ * @param string $haystack
|
|
|
|
+ * @param string|array $needle
|
|
* @return bool
|
|
* @return bool
|
|
*/
|
|
*/
|
|
function str_contains($haystack, $needle)
|
|
function str_contains($haystack, $needle)
|
|
{
|
|
{
|
|
- return strpos($haystack, $needle) !== false;
|
|
|
|
|
|
+ foreach ((array) $needle as $n)
|
|
|
|
+ {
|
|
|
|
+ if (strpos($haystack, $n) !== false) return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -361,17 +366,6 @@ function str_finish($value, $cap)
|
|
return rtrim($value, $cap).$cap;
|
|
return rtrim($value, $cap).$cap;
|
|
}
|
|
}
|
|
|
|
|
|
-/**
|
|
|
|
- * Determine if the given object has a toString method.
|
|
|
|
- *
|
|
|
|
- * @param object $value
|
|
|
|
- * @return bool
|
|
|
|
- */
|
|
|
|
-function str_object($value)
|
|
|
|
-{
|
|
|
|
- return is_object($value) and method_exists($value, '__toString');
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* Get the root namespace of a given class.
|
|
* Get the root namespace of a given class.
|
|
*
|
|
*
|