Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

PHP Programming


PHP Programming

By ghostghost | 4933 Reads |
0     0

First, to learn and test PHP on your PC you need an Apache server and maybe a MySQL database. Get All-in-one WAMP(Windows Apache MySQL PHP) here: http://www.wampserver.com/

I'm not going to give all possible things, just the most recent, most used and easiest things.

Basics of PHP:

every line ends with a ; if not, the script will not execute.

Opening tag: <?php You could also use <? but not all servers support that, so it's safer to use <?php

Closing tag: ?>

outputting text: this is done by the echo command.

When processed, this will give a page with Hello HBH on it.

Varaibles: You can recognize variables by the $-sign in front of it.

Again, this will give a page with Hello HBH on.

When combining variables, insert a . (dot) between them. Again, this will give a page with Hello HBH on.

Now that you know the very basics I'll explain the if else statement. This compares to variables, if the comparision is true it will echo something, if it's false, something else.

In this case, a page will pop up saying False! If $text2=hello then it'll echo True!

That's it for today! I'm not discouraging you but you still know jack about PHP :P but you're getting the principle I hope. If you're really going to learn HBH I suggest a book by Wiley, PHP in a nutshell. For the more advanced coders out there I suggest Secure PHP & MySQL Web Developement, Third edition by sams.

I hope y'all enjoyed my first article and learned a tiny bit about this HUGE language. Rate it boys 'n girls!

Official PHP site: http://www.php.net

-Superpimp

Comments
ghost's avatar
ghost 18 years ago

pretty good :) simple and combines all the basics, recommended for newbie php coders :D

ghost's avatar
ghost 18 years ago

Nice introduction, I personally recomend w3schools.com to continue learning ;)

ghost's avatar
ghost 18 years ago

nice! I dont know much about PHP but I got this. thanx.

ghost's avatar
ghost 18 years ago

hmm too simple imo. Nice article none the less.

ghost's avatar
ghost 18 years ago

well, it's a article for noobs, so ;)

If anyone has any requests about PHP-related articles, PM me. I might be able to help ;)

ghost's avatar
ghost 18 years ago

What about LAMP? not everyone uses "Windows"

ghost's avatar
ghost 18 years ago

Nice article.

ghost's avatar
ghost 18 years ago

"If you're really going to learn HBH I suggest a book by Wiley, PHP in a nutshell."

I've not heard of that language… - Nice article though! ^^