simple question

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 94
Joined: Sun Sep 21, 2003 5:30 pm

Thu Sep 25, 2003 1:46 am


I am wondering what is / for in this coding,, i seen a lot of samples of php source code do have this,,

echo "<td width=\"6%\" valign=\"top\"><div align=\"center\"><font size=\"2\" face=\"Arial, Helvetica, sans-serif\"><strong>Code</strong></font></div></td>";

<a href =\"view.php?id".$myrow[id]."\">view</a>

I was told that we need to use this when we include html code in php file... but i am still not really understand the usage of / in the php coding.. :?

please advise.

User avatar
php-forum Super User
php-forum Super User
Posts: 1279
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India

Thu Sep 25, 2003 3:14 am

From the code it seems you are intereseted in \ and not /

/ is used in html to close the tag eg. </font>, <br />
The XHTML specification says every tag has to be closed

The \ is used as an escape charecter, eg. if you use

Code: Select all

<?php echo ("I want to see \")?>

U will get output as "I want to see" and not "I want to see \"

So to use special charecters in strings, usage of backslash is done

Code: Select all

<?php echo ("I want to see \\")?>

Will print "I want to see \"

Post Reply