PHP program to check a case insensitive substring exists within the given string using regular expression pattern
belongs to collection: PHP Regular Expressions Programs
All Answers
total answers (1)
belongs to collection: PHP Regular Expressions Programs
total answers (1)
Program/Source Code:
The source code to check a case insensitive substring exists within the given string using a regular expression pattern is given below. The given program is compiled and executed successfully.
Output:
Explanation:
Here, we created a string variable $str, which is initialized with "www.includehelp.com". After that, we used 'i' in the pattern to search case insensitive substring in the specified string. Here we used the preg_match() function that will return 1 on a successful match, otherwise, it will return 0. Then we used the if condition to print the appropriate message on the webpage.
need an explanation for this answer? contact us directly to get an explanation for this answer