Help - Search - Members - Calendar
Full Version: [PHP] - [Extreme Basic's] - [ltjfansite]
Pixel2Life Forum > Member Tutorials and Requests > Forum Tutorial Archives > PHP Tutorials
ltjfansite
This Tut Was Writen By Freendom Of Zanmato Design and i had permision to post this tut.

You can find the ut on this page here
Click here

-------------------------------------

These are the extreme basics... good for if this is your very very first time trying to learn php

----------------------

First off, all the PHP code goes between two php tags: <?php and ?>. Example:
CODE
<?php
// All php coding here
?>

Incase you are wondering, the // before the words is so that PHP doesn't execute the words behind it as PHP, it is called commenting. There are two other ways:
  • // COMMENTS
      This comments out the rest of the line from where it starts.
  • # COMMENTS
      Comments out from where you put it for the rest of the line
  • /* COMMENTS */
      This comments from /* until */. It doesn't comment out the rest of the line like the first two. If you don't remember the */ it will comment out the whole php script.
----------------------

Now I will explain echo() and print(). What they do is print things on the page. You can use double (") or single (') quotes for either one:
CODE
<?php
echo 'This is using single qoutes.';
echo "This is using double quotes";
print "Print can do the same things";
?>

You have to escape the same type of quote you used to echo or print whatever with a backslash (\). Here is an example:
CODE
<?php
echo 'I have to escape the character \' with a backslash.
// Above will output this data:
// I have to escape the character ' with a backslash.
?


----------------------

Now the last thing I will explain in this tutorial is strings. Strings hold data, and you can access it any time after you set it's value in the script. You do so like this:
CODE
<?php
$STRING_NAME = 'The strings data';
?>

You can use double quotes (") or single quotes ('). With double quotes you have to escape other double quotes with a backslash (\). Like this:
CODE
<?php
$STRING_NAME = "Here is a quite: \"HELLO!\"";
?>

Vise versa with single quotes.

----------------------

Please post questions below. smile.gif
JaK3rIUS
thanks man. Handy
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.