In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Miguel Cruz) wrote:
> On Thu, 2 May 2002, CC Zona wrote: > > [EMAIL PROTECTED] (Miguel Cruz) wrote: > >> preg_match("/{$start}(.*?)end/", $rf, my_var); > > > > Leave out the braces. > > Don't they get removed by the parser's handling of "double-quoted" strings > long before anything makes it to preg_match()? > > I almost always use the braces when inserting variables inside string > literals, just to avoid any chance of ambiguity. There's no ambiguity here since parentheses aren't legal in variable names, so the curly braces are just excess. Given the braces' significant as special regex characters, it can be a confusing distraction in this context, especially for newbies trying to grasp simply regex syntax. Better to save the braces for where they're needed to tell the parser or programmer how to interpret ambiguous code. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php