I have built variable $line based on the following:
foreach ($regex as $each){
$parts = explode('::',$each);
$pattern = '"/^'.$parts[1].'/i"';
$subject = '$row['.$parts[0].']';
$line .= 'preg_match'.'('.$pattern.','.$subject.')';
if (end($regex) != $each){
$line .= '&&';
}
}
I have a function that call the $line. Once called, echo $line produces the following output:
preg_match("/^ab/i",$row[RG])&&preg_match("/^cd/i",$row[EX])
I am trying to use the $line variable in one of the if loops and preg_match doesn't work. However, if I were to copy and paste the value of $line in the if statement it works just fine. Any input would be appreciated!