Re: Re: Xpath arguments in variable
| From: | David Harkness | Date: | Thu, 16 Sep 2010 18:41:54 +0000 |
| Subject: | Re: Re: Xpath arguments in variable | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-308137@lists.php.net to get a copy of this message | ||
On Thu, Sep 16, 2010 at 1:20 AM, Pete Ford <pete@justcroft.com> wrote:
> On 15/09/10 18:00, David Harkness wrote:
>
>> $v = $row->xpath("//membernumber[. = \"$MemberId\"]");
>>
>
> Oooh, I hate using backslashes - they always seem so untidy...
> I have a pathological fear of sed scripts, too. :(
And yet I find them the *most* tidy in a way: \" inserts an actual
double-quote into the string. I don't think that's any more magical than
"surround it with single-quotes so it doesn't terminate the string." It will
work in single- and double-quoted strings equally, so you don't have to
worry about switching from one to the other messing up the expression.
David