simple question

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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

simple question

Postby Alicia » Thu Sep 25, 2003 1:46 am

Hi,

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

e.g:
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
ruturajv
php-forum Super User
php-forum Super User
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Use of /

Postby ruturajv » Thu Sep 25, 2003 3:14 am

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

Anyways
/ 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 \"


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 3 guests