PHP Functions | by TNH
[View the .TXT here]
PHP FUNCTIONS TUTORIAL:

-REQUIRED:

Basic Knoweldge of PHP.
Basic Knoweldge of HTML.

By TNH

Functions are a major part of coding in PHP. This article will help start you to use some preready functions, as well as coding your own. These are basic scripts, which you can adapt to use yourself. This is meant as a guide to help you learn the in's and out's of PHP functions.

Basic Functions:
Here is an example of a basic function

This is how you make your own function. This one is rather simple, but as you progress you'll see more functions you can make. The above function is what most of your functions will be based on. Basic Encoding: To encode a string or vairable in rot13, the best thing to use is the premade function str_rot13().
Another way to do this is to set up a function, though i would advize using the above.
Ok, past rot13, lets move on to md5 encrpytions. For this we'll use a premade function md5().
Thats a rather simple way to encode things. sha1() is also another function as well as CRYPT_STD_DES, CRYPT_EXT_DES, CRYPT_MD5, and CRYPT_BLOWFISH are all different encryptions. You can also use math elements to encode something.
That is how you can use math to help you encode a string. You can also use operators like divide, subtract and multiply. Saving and Mailing Functions: To save, we start off with a basic script like this:
Alternitivly, you can use the mail() function. This will send the text to your mail.
Now to make it so what is emailed is user posted. To do this, you need to incorperate HTML.
This is good if you want user submitted data sent to you. From here you can take the script, and make it send to mulituple emails, or have it saved and sent. Theres alot you can do with these scripts, so be imaginitive! Extra: Here is one of my better scripts. This Function is used to count each character and all the characters together in the string.
The next example is a simple login for PHP
That is the end of the tutorial. Hopefully you will have learned something new from this, and will use the knowledge to help better your PHP codes.

-TNH