Gray Hat World - Internet Marketing Forum
    home search help facebook twitter

Gray Hat World - Internet Marketing Forum » General Computer Discussion » Graphics And Design » Website Construction » PHP/HTML/CSS » [Tutorial] Getting started
Current time: 06-19-2013, 12:02 AM Hello There, Guest! (Login — Register)

Register for full access and no ads



Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode | Linear Mode
[Tutorial] Getting started
07-08-2009, 05:28 PM
Post: #1
Sophie Offline
Litte Baby
Posts: 18
Joined: Jul 2009
Reputation: 0
Experience: 133
Wink [Tutorial] Getting started
Getting started with php


Getting started in Php

Lets get to know the common, useful functions of Php...

A php file uses an extension of : .php | Example : index.php
When you start a php file you will always use "<?php" to start the script, and to close the script you use "?>".
Example :
PHP Code:
<?php

?>

Php files normally contain HTML tags, just like HTML files, and some php scripting code.

Here is an example of a simple Php script which sends the text "Hello World" to the browser.
Example :
PHP Code:
<html>
<
body>
<?
php
echo "Hello World";
?>
</body>
</html> 

Each php code line ends with a semicolon ";" this is used to separte one set of instructions to another.

There are two basic statements to output text with PHP: echo and print. In the example above we have used the echo statement to output the text "Hello World".

Note: The file must have a .php extension. If the file has a .html extension, the PHP code will not be executed.


Php Comments

Php comments can be quite important, obviously to help you remember and guide you, but if you release a php file, you normally write about each part of the script.

To start a comment beside/above/below the script you must use "//"
If you are doing more than one line comment you must use "/*" followed by "*/"

Example :
PHP Code:
<html>
<
body>
<?
php
// This is a single line comment

/*
This is
a comment
on more than
one line
*/

?>

</body>
</html> 

Enjoy, and make sure you don't miss out on the next tutorial..
Find all posts by this user
Quote this message in a reply
07-10-2009, 07:10 AM (This post was last modified: 07-10-2009 07:10 AM by ffs.)
Post: #2
ffs Offline
Account Closed
Posts: 17
Joined: Jul 2009
Experience: 84
RE: [Tutorial] Getting started
very useful i think. and more clear than the *How To* guides i have googled Smile

(but still dont get a thing >.<.... examples. wer did u kno to add <body> and what it does)
and
<html> // why this?
<body> // n what this does?
<?php // this i know. it starts the script rite?
echo "Hello World"; // why echo?
?> // this ends the script if im rite
</body> // these again :/
</html> // - || -
Find all posts by this user
Quote this message in a reply
07-11-2009, 01:32 PM
Post: #3
Sophie Offline
Litte Baby
Posts: 18
Joined: Jul 2009
Reputation: 0
Experience: 133
RE: [Tutorial] Getting started
(07-10-2009 07:10 AM)ffs Wrote:  very useful i think. and more clear than the *How To* guides i have googled Smile

(but still dont get a thing >.<.... examples. wer did u kno to add <body> and what it does)
and
<html> // why this?
<body> // n what this does?
<?php // this i know. it starts the script rite?
echo "Hello World"; // why echo?
?> // this ends the script if im rite
</body> // these again :/
</html> // - || -

Oh Well <html> is like the website code, you always start with when making a full web page.
<body> is the body of the web page.
<?php is the script yes
echo "" prints text


</">
ends code.
Find all posts by this user
Quote this message in a reply
10-30-2011, 11:17 PM
Post: #4
imperialknight Offline
Litte Baby
Posts: 8
Joined: Oct 2011
Reputation: 0
Experience: 35
RE: [Tutorial] Getting started
nice tutorial i think ^^
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | Gray Hat World - Internet Marketing Forum | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication

Powered By MyBB, © 2002-2013 MyBB Group.
Theme By GFX Palace.