Zahid Habib
Members
-
Joined
-
Last visited
Reputation Activity
-
Zahid Habib reacted to Ixnay in A Great Place for Stocks!StockGarage.net: Restocked and Revamped
The graphic designer's number one stop for free, legal, categorized stock images.
- 100% legal, free stock photography
- No registration required
- Visit today: www.stockgarage.net
::: Brought to you by the FringeFX.net Art and Design Community :::
These stocks can be used for commericial or personal works. If you needed an image/texture for your website... BINGO!
-
Zahid Habib reacted to webdeveloper93 in TUTORIAL: PHP FunctionsOk imma start out by explaining what a php function is a function in php basicly can be used to hold blocks of code that you wanna use more then one time in your scripts. To start a function you write out the word
function like so then you give the function a name
function mycat() { //Block of code goes here }
So say you wanted to have a function that protects variables when inserted in a database you could do this
function protect($value){ $value = mysql_real_escape_string($value); return $value; }
So this code creates a function that uses mysql_real_escape_string to protect any variable you might like if your inserting it into a database to use this function just call it like this.
$myvariable = protect($_POST['name']);
So as you can see we wrapped our function around $_POST['name'] this will protect whatever value name is when inserted into a mysql database.
To simply output something that is inside a function you would do this
function hello(){ echo "HELLO WORLD!"; }
Then call this function like this
hello();
And that when ran will print out HELLO WORLD!
so this was a short tutorial on functions and how to
use them in php if you
like this tutorial give me a +1 thanks