/ Published in: PHP
Once in a while we need to check whether a string contains substring, some other string or characters or a value. Checking for existence of a string (or substring) inside another string is easier than it might seem. The following article describes how to check for whether a string contains string in PHP, or simply said how to find string within string in PHP.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
if( $intPos === false ) { // string strNeedle NOT found in strHaystack } else { // string strNeedle found in strHaystack }
URL: http://www.maxi-pedia.com/string+contains+substring+PHP