Guys I have one set of commands that calculates Balance figure. I need balance figure on different pages. Right now I have added that set in each page. But I face difficulty whenever I have to make changes in commands. So I want that I create function in one file and then I can call that function from any file that can calculate and bring balance figure for me. How to do this, please help me. GCS
... may be you want get the function, that should be using within other files? include "fun.php"; fun('sd'); i think i wrong you understand..
1. create a PHP file e.g. func.calculate.php (put under "functions" folder for any functions would be fine) <? function FunctionName($parameterNeeded){ // make some function here that return the result $result = $parameterNeeded; // example return $result; } ?> 2. in any page that require the FunctionName() function you need to add - require_once('func.calculate.php'); or - include_once('func.calculate.php'); to call the function you need only to write this. $result = FunctionName($parameterNeeded); Sometimes, it's better to put the include_once() or require_once() within the head section so you need not to write it again. CMIIW...
so simple you can make all you're functions in one file "functions.php" than you include it in the files when you want to call you're functions with <?php include"functions.php"; ?> PHP: then you call it ^^