user1613566
user1613566

Reputation: 21

echo php tags in php

I want to print php tags in php file so I am using

$variable="<?php   
include("./$folder/$folder.php"); 
?>";
echo "$variable";

but its giving me error

Parse error: syntax error, unexpected T_STRING

Upvotes: 0

Views: 1648

Answers (1)

user142162
user142162

Reputation:

You need to escape the double quotes using the backslash character (\):

$variable="<?php   
include(\"./$folder/$folder.php\"); 
?>";

You can also clean up your echo expression by dropping the unnecessary quotes:

echo $variable;

Upvotes: 4

Related Questions