Lewisthemusician 0 Report post Posted September 25, 2007 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 : <html>and </html>However in PHP, to start off a PHP script you use: <?or <?phpand to close it you use ?>In this case we will be using the first choice so inside your page place this 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 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. <?echo "Hello";?>You can also change the quotations to single's eg <?echo 'Hello';?>These both would show up like this: Hellobut 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 <? Step 2: Make a variable called greeting $greeting = ""; Step 3: Define whats happening in the variable so in this case we would say we want text to show up saying "Hello" $greeting = "Hello"; Step 4: Echo this variable echo $greeting; Step 5: Close the PHP Brackets ?> So, altogether that would look like this: <?$greeting = "Hello";echo $greeting;?>This to would end up looking like this on a page 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! Share this post Link to post Share on other sites
toby 0 Report post Posted September 26, 2007 You miss some things out, like where you can open and close, why you need <?php and ;, but otherwise good. Share this post Link to post Share on other sites
anakintyler 0 Report post Posted October 28, 2007 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. Share this post Link to post Share on other sites
Jonnii 0 Report post Posted February 10, 2011 Its a nice introduction, PHP has been something ive been meaneing to learn for about 3 years now and keep putting it off! Need to learn now though as im trying to get a website up and running to make some petty cash for the little one on the way :PThanks again Share this post Link to post Share on other sites
spawN-eD 0 Report post Posted February 21, 2011 nice tut GL Share this post Link to post Share on other sites
infotornix 0 Report post Posted February 22, 2011 Well its nice for the new bees in php but you can use some online tutorial for this. Share this post Link to post Share on other sites