views:

34

answers:

3

I am sending this to a function, and I want double-quotes around the value of the variable below, example $var = "New York" (note the quotes)

   $fq.=" + area:$state";

So when I echo $state I want double quotes around it, how can I do this?

Thanks

+1  A: 
$var = '"New York"';
Felix Kling
+1  A: 
$var = '"New York"';
kemp
+3  A: 

You can write it like this:

$fq .= " + area:\"$state\"";

The backslash escapes special characters(like newline, tabs or quotes) in double quoted strings.

ZeissS