This tutorial will help you to check if a string contains any substring in PHP programming language. For example, you want to run a specific line of code only if an input string contains another substring in it.

Advertisement

Here is a sample PHP programme, which will evaluate to true because the main string $str contains the substring ‘TecAdmin‘ in it. This will print “true”.

Another PHP program will evaluate to false because the main string $str doesn’t contains the substring ‘Hello‘ in it. This will nothing print.

Share.

1 Comment

Leave A Reply


Exit mobile version