note 126560 deleted from function.str-contains by cmb
| From: | cmb@php.net | Date: | Sat, 06 Nov 2021 10:58:26 +0000 |
| Subject: | note 126560 deleted from function.str-contains by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-217145@lists.php.net to get a copy of this message | ||
Note Submitter: kawewong at gmail dot com
----
Case in-sensitive version of str_contains().
<?php
if (!function_exists('stri_contains')) {
/**
* Determine if a string contains a given substring (case in-sensitive)
*
* @link https://www.php.net/manual/en/function.str-contains.php
The original
str_contains function by PHP.
* @param string $haystack The string to search in.
* @param string $needle The substring to search for in the haystack.
* @return bool Returns true if needle is in haystack, false otherwise.
*/
function stri_contains(string $haystack, string $needle): bool
{
return str_contains(strtolower($haystack), strtolower($needle));
}// stri_contains
}
?>