I have stored as |1|7|11|
.
I need to use preg_match((
to check |7|
is there or |11|
is there etc.
How do I do this?
Use the faster strpos if you only need to check for the existence of two numbers.
if(strpos($mystring, '|7|') !== FALSE AND strpos($mystring, '|11|') !== FALSE)
{
// Found them
}
Or using slower regex to capture the number
preg_match('/\|(7|11)\|/', $mystring, $match);
Use regexpal to test regexes for free.