WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You

WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You


You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1Accespted Rules in PHP Fri Dec 17, 2010 10:25 pm

Unknown Data

Unknown Data
Registered Member
Registered Member
Rules in PHP
Learn PHP - part 2


In this lesson will we take a look at the basic rules in PHP.

Quotation marks in text
We just grab a couple our example from the previous lesson and work a little further with it.
Code:
<html>
<head>
<title>Example</title>
</head>
<body>

    <?php
    echo "Hello world!";
    ?>

</body>
</html>
As we learned, will it show following.

Hello world!

From the previous lesson, learned we that a PHP script starts with <?php or and ends with ?>.
Since we've saved the document with .php extension, the server must be parsed before the final document is forwarded to the calling browser. In the document, the server encounters the <?php which indicates that there is php code below. PHP section ends with ?>.
We mentioned earlier that everything that's printed which stands between the quotation marks. But what if you want to use the quotation marks in a text to be printed? Immediately will this result cause an error. And therefore is it necessary to use a backslash before the quotation marks. So it looks like this now.
Code:
<html>
<head>
<title>Example</title>
</head>
<body>

    <?php
    echo "Hello world!";
    ?>

</body>
</html>
Here is another example to show how it works.
Code:
<html>
<head>
<title>Example</title>
</head>
<body>

    <?php
    echo "<font size="4">Here is a example with "font size".</font>";
    ?>

</body>
</html>
You may not immediately see that we used PHP in the document. Looking more closely at the returned source code does it look like the following:
Code:
<html>
<head>
<title>Example</title>
</head>
<body>

    <font size="4">Here is a example with "font size".</font>

</body>
</html>
Comments
In some situations can it be very nice to be able to give a comment in connection with PHP programming. This can make your script more manageable, and when some time has went by, will the comment help to refresh the understanding of the program.
An example could be.
Code:
$var = something"; // Here is the comment beside the variable
So comments are actually shownable by //.

As Dimon quickly saw, can you also use these to comments.
Code:
$var = something"; -  #  this is another method for single line comments
$var = something"; -  /* This is used to make multiple line comments
                      Like this */

In next lesson will we work with the variables.

Notice : This tutorial is copyrighted by WebArtz Forum. You may not publish it on anywhere without written permission from the administrators.



Last edited by Unknown Data on Sun Dec 19, 2010 5:58 pm; edited 2 times in total

http://woops.dk

2Accespted Re: Rules in PHP Sun Dec 19, 2010 9:30 am

YanOri

YanOri
Registered Member
Registered Member
Nvery nice UD, Keep them comming Smile
BTW, Comments on PHP are made by using the following methods

Code:

1 -  // this is the method as you explained
2 -  #  this is another method for single line comments
3 -  /*  */ 

/* This is used to make multiple line comments
          Like this */

3Accespted Re: Rules in PHP Sun Dec 19, 2010 5:55 pm

Unknown Data

Unknown Data
Registered Member
Registered Member
Thanks! Smile

I'll add that about comments from you Dimon, and some credit.

http://woops.dk

4Accespted Re: Rules in PHP Sun Dec 19, 2010 6:38 pm

YanOri

YanOri
Registered Member
Registered Member
Thanks for the credits UD Smile

5Accespted Re: Rules in PHP Tue Dec 21, 2010 4:47 pm

Emilio

Emilio
Registered Member
Registered Member
Wow , you make it really easy to understand , good job UD

http://www.graphilicious.forumotion.Com

6Accespted Re: Rules in PHP Tue Dec 21, 2010 8:25 pm

Unknown Data

Unknown Data
Registered Member
Registered Member
And thanks to you for the input Dimon. Smile

Thanks Emilio! =D

http://woops.dk

Sponsored content


View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum