# [SOLVED] How to echo [PHP]&lt;?php ?&gt;[/PHP] in PHP



## Moatist

Is it possible to echo


PHP:


<?php whatever ?>

 in php without it thinking that its ending/starting?


----------



## carsey

*Re: How to echo [PHP]<?php ?>[/PHP] in PHP*

How do you mean.

The php echo is just:



PHP:


php echo 'hello';

Obviously if you want it to echo a string of dat you would use $text in replace of Hello, but you would need to make $text say something, if you get what I mean.


----------



## Moatist

*Re: How to echo [PHP]<?php ?>[/PHP] in PHP*

I meant for example:



PHP:


<?php

echo "<?php include(file.txt); ?>";

?>

Would that work?


----------



## jamiemac2005

*Re: How to echo [PHP]<?php ?>[/PHP] in PHP*

use single quotes and php should treat it as a regular string rather than php code(it shouldn't do that either but give it a go). or change the symbols to HTML entities like so:



PHP:


$myString = "<?php include(file.txt); ?>";
$myParsedString = htmlentities($myString);
echo $myParsedString;

//or

$myString = '<?php include(file.txt); ?>';
echo $myString;

One of them should work.

Cheers,
Jamey


----------



## Moatist

*Re: How to echo [PHP]<?php ?>[/PHP] in PHP*

Thanks all! My problem is solved.


----------



## jamiemac2005

*Re: How to echo [PHP]<?php ?>[/PHP] in PHP*

Glad you got a solution.

Cheers,
Jamey


----------

