Penguin
Note: You are viewing an old revision of this page. View the current version.

by JeremyArnold?

Introduction

PHP was created for serverside scripting of WebPages. From humble beginnings, it has become one of the most powerful languages for web application development.

Advantages of PHP (over other languages):

  • Rapid Development: PHP is simple, fast and effective.
  • PHP can be as simple or as complex as you like.
  • One of the best Manuals of ANY language I've used (or even tried to learn) http://www.php.net/manual/en/
  • C/++ based, if you can program in C/++ or even PERL or JAVA, you should be able to take to it like a fish to water.
  • Built in mySQL API (built in SQL DB in PHP5beta)
  • so many many more ....

Cons of PHP:

Yes, there are some downsides to PHP

Getting Help!

Always check the online manual. It has a wealth of user submited notes and is categorised by Function.

You can generally find the author in either #wlug or #phphelp on the UnderNet IRC network. There is also #php on the same network but #phphelp is so much better! (shameless plug) ;)

If there is enough interest I will continue to expand this section as I have time / people bug me.

Installation

See the docs below (outdated) or the Manual ... This is one program where it pays to read the manual when things down work. Else come and me ask nicely.

Tips

DONT put $_POST, $_GET or $_REQUEST varible straght into an SQL statment! Rather put the varible through the mysql_escape_string() function. Ignoring this leaves you database exposed to attacks from ScriptKiddies.
ie.

$myVarFromForm = mysql_escape_string($_REQUEST['myVarFromForm'?); $SQL = "SELECT * FROM mytable WHERE mycol = '$myVarFromForm'";

"" != '' - you can insert varibles directly into double quoted strings! Arrays (and objects) can also be inserted this way by puting the varible in a set of {} squiglyBrakets !
ie.

$var = 'Hello ' . $name . ', ' . $myArray[3? . ' is the 3rd array element';

can be writen as

$var = "Hello $name, {$myArray[3?} is the 3rd array element";

I would tend to use {$name} for clarity.