I have an array of characters -
$operators = array('%', '*', '+', '-', '@');
and a string for eg-
$text = '%@';
How can I find if the string contains two values from the array in concatenation -
Like $text = %test% - valid, but $text = %+test should fail ($concat = TRUE).
This is what I've tried -
$concat = FALSE;
foreach ($operators as $op) {
$opPosition[$op] = strpos($text, $op);
// Here I need to check if any two values of
// $opPosition are neighbours, set the $concat variable to TRUE.
}
How do I make a check for $opPosition or is this the only way what I'm trying ?
preg_match_all()preg_match("/[%\*\+\-@]{2,}/", $text);%+test?