Forum     

Go Back   Digit Technology Discussion Forum > Portables, Peripherals and Electronics > QnA (read only)
Register FAQ Calendar Mark Forums Read

QnA (read only) Mods please help transfer the contents of this forum to proper sections. :)


 
 
LinkBack Thread Tools Search this Thread Display Modes
Old 22-07-2005, 01:22 PM   #1 (permalink)
Human Spambot
 
tuxfan's Avatar
 
Join Date: Feb 2004
Location: Mumbai
Posts: 2,653
Default Help a PHP newbie


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;
tuxfan is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 22-07-2005, 02:47 PM   #2 (permalink)
sunnydiv
Guest
 
Posts: n/a
Default

try using \ in creative ways

to cancel the < or the ?

and see how it works out
 
Old 22-07-2005, 02:48 PM   #3 (permalink)
Wise Old Owl
 
alib_i's Avatar
 
Join Date: Jun 2004
Location: omnipresent
Posts: 1,191
Default

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
__________________
What I've felt, What I've known; Never shined through in what I've shown
Never free, Never me; So I dub thee unforgiven
-Metallica
alib_i is offline  
Old 22-07-2005, 07:01 PM   #4 (permalink)
In Pursuit of "Happyness"
 
kalpik's Avatar
 
Join Date: May 2005
Location: New Delhi
Posts: 3,432
Default

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.
__________________
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain
kalpik is offline  
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by abhidev
- by topgear
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 06:53 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2