RobinTibbs Posted January 19, 2007 Share Posted January 19, 2007 pretty simple q which i can't seem to find an answer to, can i include a variable in a regular expression as such:[code]$array = ( ....... );foreach($array as $value) {preg_match('($value)', <string>, $matches);}[/code] Quote Link to comment Share on other sites More sharing options...
effigy Posted January 19, 2007 Share Posted January 19, 2007 Yes. The same PHP syntax rules apply: variables are not interpolated in single quotes. Use double quotes or concatenation. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.