1 2 3 4 5 6 | function hasWord($word, $txt) { $patt = "/(?:^|[^a-zA-Z])" . preg_quote($word, '/') . "(?:$|[^a-zA-Z])/i"; return preg_match($patt, $txt); } $string = 'This is my own paragraph.'; echo hasWord('no', $string); |
Recent Posts
Recent Comments
- LogixTree Networks on Localhost showing “Index/of” instead of displaying the Website
- AMANUR RAHMAN on Localhost showing “Index/of” instead of displaying the Website
- Christy on Support Purchase Notes in Order Emails WooCommerce
- LogixTree Networks on Localhost showing “Index/of” instead of displaying the Website
- Sofia on Localhost showing “Index/of” instead of displaying the Website