2

I have a variable $teste = hiiiii

I need to put the variable inside a quote and a double quote. Like this:

"'$teste'" for the value be this "'hiiiii'"

I'm trying concatenation but not working. How do that???

4

3 回答 3

4

你可以逃避你的报价:

echo "\"'$teste'\"";

将打印出:"'hiiiii'"

于 2013-08-09T18:35:44.240 回答
2

你可以这样做:

$result = '"\'' . $teste . '\'"';

这将导致:"'hiiiii'"

演示

先试后买

于 2013-08-09T18:34:57.667 回答
0

使用单引号和双引号的基本作弊

$test = 'hi';
echo '"'."'".$test."'".'"';
echo "'".'"'.$test.'"'."'";
于 2013-08-09T18:44:58.700 回答