468,765 Members | 802 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

echo "<?php"

hi,
i want to echo the string '<?php' in a php script like :

echo "<?php";

but when i try nothing gets displayed ...

if I use

echo "<\?php";

then the string is displayed as : <\?php

Is there anything I can do ??
Jul 17 '05 #1
5 2143
Jonny T <jo****@someisp3.com> wrote:
i want to echo the string '<?php' in a php script like :

echo "<?php";

but when i try nothing gets displayed ...

if I use

echo "<\?php";

then the string is displayed as : <\?php

Is there anything I can do ??


Yes, have a look at the HTML source.

JOn
Jul 17 '05 #2
use htmlspecialchars like this
$phpstrsp="<?php";
$phpstrsp=htmlspecialchars($phpstrsp);
echo $phpstrsp;
"Jonny T" <jo****@someisp3.com> ???????/???????? ? ???????? ?????????:
news:c4**********@sparta.btinternet.com...
hi,
i want to echo the string '<?php' in a php script like :

echo "<?php";

but when i try nothing gets displayed ...

if I use

echo "<\?php";

then the string is displayed as : <\?php

Is there anything I can do ??

Jul 17 '05 #3
Ike
Just looking at how I have done it succesfully in the past as....
$fp = fopen($savename, "w+");
fputs($fp, "<?php" . "\n");

//-Ike
"Jonny T" <jo****@someisp3.com> wrote in message
news:c4**********@sparta.btinternet.com...
hi,
i want to echo the string '<?php' in a php script like :

echo "<?php";

but when i try nothing gets displayed ...

if I use

echo "<\?php";

then the string is displayed as : <\?php

Is there anything I can do ??

Jul 17 '05 #4
"Jonny T" <jo****@someisp3.com> wrote in message
news:c4**********@sparta.btinternet.com...
i want to echo the string '<?php' in a php script like :

echo "<?php";

but when i try nothing gets displayed ...


Try:
echo "&lt;?php";

-or-

echo '<?php';
Jul 17 '05 #5
On Wed, 31 Mar 2004 14:23:21 +0000, Jonny T wrote:
hi,
i want to echo the string '<?php' in a php script like :

echo "<?php";

but when i try nothing gets displayed ...

if I use

echo "<\?php";

then the string is displayed as : <\?php

Is there anything I can do ??

echo '&lt;php'
You need to use the HTML entities character for '<' which is '&lt;'
(LessThan). This will also be valid (X)HTML too where '<?php' would not
even if it was displayed as you expected =)

Regards,

Ian
[XP honoured.. FU: comp.lang.php]

--
Ian.H
digiServ Network
London, UK
http://digiserv.net/

Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Danny Anderson | last post: by
12 posts views Thread by aa | last post: by
3 posts views Thread by aa | last post: by
1 post views Thread by Christian Schmidbauer | last post: by
16 posts views Thread by rik | last post: by
3 posts views Thread by hSiplu | last post: by
2 posts views Thread by Bill H | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.