Check if string contains specific word with PHP

<?php $str = 'My name is Bryan Lusica'; //lets check for the word Bryan if (strpos($str, 'Bryan') !== false) { echo 'The word Bryan exist'; } ?>
This code snippet will show you how to check if string contains specific word with PHP.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.