tags:

views:

42

answers:

1

Hi ,

i just need to add in a variable into the xpath my code is as followed

$target = $xml->xpath('//gig[@id=$1]');

but I need it too but something like

$target = $xml->xpath("//gig[@id=$" $change . "]");

Is this possible ?

If so could some one help ?

+2  A: 

Use:

$target = $xml->xpath("//gig[@id=$". $change . "]");

or, if you do not need the $ sign

$target = $xml->xpath("//gig[@id=". $change . "]");

If you need to escape a character like " in php use

\"
Adnan