|
Posted by lawrence k on 11/09/06 15:33
Juliette wrote:
> lawrence k wrote:
> > Suppose I have these five lines in a file somewhere:
> >
> > <p>This entry should belong to:
> > <select name="formInputs[id_of_neighborhood_to_which_this_belongs]">
> > <option value="">(No choice made)</option>
> > <?php getDatabaseTableValuesInOptionTags("neighborhoods", "id",
> > "state"); ?>
> > </select>
> >
> > Suppose I open this file and read the contents into a string called
> > $string. Suppose I then give the string to this function:
> >
> >
> > function matchAllPhpFunctionsInString($subject=false) {
> > // 11-08-06 - this is being called in importForm
> >
> > $pattern = "<";
> > $pattern .= "\?php.*\(.*\); \?";
> > $pattern .= ">";
> > $pattern = "/$pattern/";
> > preg_match_all($pattern, $subject, $matches);
> > // print_r($matches);
> >
> > // 09-19-06 - there is no point returning a 2 dimensional array, so we
> > will make
> > // it one dimensional.
> > $arrayOfPhpFunctionNames = $matches[0];
> > return $arrayOfPhpFunctionNames;
> > }
>
>
> In the pattern you ask for '; ?>', i.e. semi-colon-space-questionmark.
>
> In the code snippet you provided, there is more than one space behind
> the semi-colon, ergo: it is correct that the pattern does not match the
> code snippet.
Thanks so much! It's funny, I stared at that for a long time, and never
noticed the extra space!
Navigation:
[Reply to this message]
|