I know you can use arrays with preg_replace but I need to match 2 arrays. 1 array is with forbidden chars and the other is with the variables I want it to find in. Basically:
$invalidChars = array("#/#", "#\\#", "#'#", "#\"#");
$matchIn = array("var1" => $var1 , "var2" => $var2);
If I do the following to match them:
if(preg_match($invalidChars, $matchIn)){
echo "Invalid chars found";
die();
}else{
"No invalid chars";
die();
}
then PHP throws me the following error
Warning: preg_match() expects parameter 2 to be string, array given
If it's not possible to use preg_match with 2 arrays how would I check if the variables contain one or more of the invalid charachters?