Help a PHP newbie

Status
Not open for further replies.

tuxfan

Technomancer
Here's the code of a .php file
Code:
<html>
<head></head>
<body>


This is before SCRIPT LANGUAGE="PHP" tag starts

<script language="PHP">
  echo("If you can see this, PHP is working with SCRIPT LANGUAGE=\"PHP\" tag");
</script>

This is after SCRIPT LANGUAGE="PHP" tag ends





This is before usual PHP tag starts

<?php
  echo("If you can see this, PHP is working with usual \"<?php ?>\" tag");
?>

This is after usual PHP tag ends
</body>
</html>

Here's the output. Notice the output of 2nd block, 2nd line.
Code:
This is before SCRIPT LANGUAGE="PHP" tag starts
If you can see this, PHP is working with SCRIPT LANGUAGE="PHP" tag
This is after SCRIPT LANGUAGE="PHP" tag ends

This is before usual PHP tag starts
If you can see this, PHP is working with usual "" tag
This is after usual PHP tag ends

I know the problem. Here's the html source code that the browser receives.
Code:
<html>
<head></head>
<body>

This is before SCRIPT LANGUAGE="PHP" tag starts

If you can see this, PHP is working with SCRIPT LANGUAGE="PHP" tag
This is after SCRIPT LANGUAGE="PHP" tag ends





This is before usual PHP tag starts

If you can see this, PHP is working with usual "<?php ?>" tag
This is after usual PHP tag ends
</body>
</html>

I know why this happens. How to display <?php ?> in the browser?

Studying the source of this page gives the following way. Is there no other way?
Code:
&lt;?php ?&gt;
 
S

sunnydiv

Guest
try using \ in creative ways

to cancel the < or the ?

and see how it works out
 

alib_i

Cyborg Agent
hmmm .. nice !

anything the browser gets inside <? and > is treated as some script .. and not displayed by browser.

its not a problem with php, its the way browser displayes text.

-----
alibi
 

kalpik

In Pursuit of "Happyness"
That is the whole point of PHP! It is a server side language, so all ur code is safe, it cannot be viewed by anyone else.
 
Status
Not open for further replies.
Top Bottom