Jump to content

how to tell if a string contains a substring


robcrozier

Recommended Posts

Hi, can anyone tell me how i can check to see if a large string contains a substring in any position at all, by this i mean that the substring could occur at the start, middle or end of the actual string. If the substring is found i would then like a flag to be raised. maybe using a boolean or something.

 

thanks guys!

int strpos ( string haystack, mixed needle [, int offset] )

 

 

Returns the numeric position of the first occurrence of needle in the haystack string. Unlike the strrpos(), this function can take a full string as the needle parameter and the entire string will be used.

 

www.php.net/function.strpos

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.