Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Php Starter Guide, Made By Me
Lewisthemusician
post Sep 25 2007, 06:55 PM
Post #1


Member [ Level 2 ]
Group Icon

Group: Members
Posts: 51
Joined: 5-January 07
Member No.: 19,160



Contents

Introduction

In this tutorial, you will learn about PHP, i will start with this and then make more parts to it until i have completed a few parts which will cover the whole range of PHP. I hope you will learn lots from this tutorial and when you finish you will know loads. I have benefited from learning this way and that's why i have written it out as a tutorial for others to learn from.

Start Off PHP

Now to start off create a page with any name, it doesn't really matter. However you need to make the page end it .php
When you are using PHP, you need to define it and tell the page you are using it, so this is kind of like :
CODE
<html>

and
CODE
</html>

However in PHP, to start off a PHP script you use:
CODE
<?

or
CODE
<?php

and to close it you use
CODE
?>

In this case we will be using the first choice so inside your page place this code.
CODE
<?

?>


Inside these brackets with question marks you can place any php stuff you like.

Echo

Then let's say you want to input some text, in PHP there are 4 ways
CODE
echo 'text';
print 'text';
return 'text';
die 'text';

(Note that die will shut down the rest of your script so nothing else below it will run, making it useful for errors and things.)
But for now you do not need to know them so we will be using echo.
So in between the brackets insert the echo which would look like this.
CODE
<?
echo "Hello";
?>

You can also change the quotations to single's eg
CODE
<?
echo 'Hello';
?>

These both would show up like this:
CODE
Hello

but don't worry about that for now.

Variables

In PHP there are such things called variables, these define a certain object.
To cut it down into baby language imagine you have a file in your "My Documents" folder, then, placing the variable into a echo is like making a shorcut on your desktop.
In This example we will be changing the "Hello" text into a variable then place the variable into the echo to show on the page, i have broken this down into steps to explain it.

Step 1: Open the PHP brackets
CODE
<?

Step 2: Make a variable called greeting
CODE
$greeting = "";

Step 3: Define whats happening in the variable so in this case we would say we want text to show up saying "Hello"
CODE
$greeting = "Hello";

Step 4: Echo this variable
CODE
echo $greeting;

Step 5: Close the PHP Brackets
CODE
?>


So, altogether that would look like this:
CODE
<?
$greeting = "Hello";
echo $greeting;
?>

This to would end up looking like this on a page
CODE
Hello


That's the end for part 1, look out for part 2 where i will more like the if command and if..else command as well as more in depth explanations of PHP.

Enjoy!
Go to the top of the page
 
+Quote Post
toby
post Sep 26 2007, 07:25 AM
Post #2


Premium Member
Group Icon

Group: Members
Posts: 478
Joined: 29-September 06
Member No.: 16,228



You miss some things out, like where you can open and close, why you need <?php and ;, but otherwise good.
Go to the top of the page
 
+Quote Post
anakintyler
post Oct 28 2007, 05:46 PM
Post #3


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 8
Joined: 28-October 07
Member No.: 25,774



Very good tutorial for php very good and short even though I think it would have been better if it had more details using more codings.
Go to the top of the page
 
+Quote Post
vmkrightpoint
post Feb 15 2008, 07:01 AM
Post #4


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 16
Joined: 23-January 08
Member No.: 27,832



i gave this page to my friend and he likes it!

Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Character Modeling For 3ds Max(4)
  2. Do You Program/code Your Own Games(11)
  3. (Nearly) Ultimate Music Posting Guide(11)
  4. Just Made This Cd Cover For A Friend(3)
  5. How To Connect Dual/triple Monitor + Advantages(21)
  6. Runescape Money Guide(47)
  7. Add A Forum To Your Site(20)
  8. Banner Made For A Friend(9)
  9. Apache Tutorial: Enable mod_rewrite In Windows(2)
  10. What Made You Switch To Linux?(60)
  11. Pre Loader Tutorial For Flash(6)
  12. Run A Webserver From Usb-stick On Windows Guide(2)
  13. Runescape Multi Logon Guide(7)
  14. Rags To Riches Iv - My Best Guide(9)
  15. Like My New Banner?(8)
  1. My Sigs(5)
  2. Attack Script In Php(5)
  3. A Guide To Using Ftp(2)
  4. Guide For Beginner Convert Video To Psp(2)
  5. Which Os Would Be First To Respond With ....(4)
  6. Help Me Make A Guide To Website Making!(0)
  7. The Ultimate Businness Man Online Game Guide(2)
  8. My Guide On Runescape Making Millions(4)
  9. Website Navigation Hover Buttons Stick So Made Css Today(7)
  10. Login Made Easy(0)
  11. C++ Meters To Feet And Feet To Meters Program(0)
  12. An Absolute Basic Guide To Algorithms For Dummies(0)
  13. Barebone Kit Completion- Need Second Opinions(3)


 



- Lo-Fi Version Time is now: 20th August 2008 - 10:39 AM