reference, tutorial, tutorials, help, example, photoshop, html, php, mysql, 3d software, internet, graphics, programming, multimedia

Working with PHP functions [1/2]

Type: Code reference, tutorial, tutorials, help, example, photoshop, html, php, mysql, 3d software, internet, graphics, programming, multimedia
Working with PHP functions
Level: Beginner reference, tutorial, tutorials, help, example, photoshop, html, php, mysql, 3d software, internet, graphics, programming, multimedia 
Working with PHP functions
Date: 2006-Dec-04
Working with PHP functions
Visited: 957 times
Working with PHP functions
Rating: Working with PHP functions
Working with PHP functions
Author: Ivory Morhuld
Many times we need to use code to do one thing with different input values. If put this code at each place where we need this funtionality files in our PHP project will grow up with more lines of code. On this we say code mess.

For this we have to use PHP Functions.

First of all we need to declarate this function. Once this function is declarated we can use it many times. This function its good to be placed outside the main code, in external PHP file. You can name it – functions.php or something similar.

Declaration of functions is announce of his name, the count of input values, and their mandatory. In our example $var and $var2 is mandatory, $varN is not. This is because at the time of declaration we announced this var with $varN="".

The end resut of each function we can see by making return statemane. This can be true or false, the sum of ($var + $var2) or something other what we need.

<?php
function my_func ($var1$var2$varN="") {
    if ((
$var1>$var2) or (strlen($varN)<10)) {
        return 
true;
    } else {
        return 
false;
    }
}
?>
reference, tutorial, tutorials, help, example, photoshop, html, php, mysql, 3d software, internet, graphics, programming, multimedia - Working with PHP functions [1/2] - reference, tutorial, tutorials, help, example, photoshop, html, php, mysql, 3d software, internet, graphics, programming, multimedia

Need a specific tutorial? Do not hesitate and submit a request!
Keywords: remote desktop port  function overloading c++  3ds max glass material  select query in PHP  exception handling in c++  PDF page rearrange  multlevel inheritance  my windows check  how to use virtualdub  barcode in coreldraw  how to restore my desktop on windows xp  configure ccproxy  trillian webcam  rename multiple files  funtions of c++  secure mysql c++ remote server  checking .net versions on windows xp  php infofile  mput with parameters  default password for plesk