6. Functions in PHP

Functions (Basic) :
  • To keep the script from being executed when the page loads, you can put it into a function.
  • A function will be executed by a call to the function. 
  • You may call a function from anywhere within a page. 
  • Syntax:
    function functionName()
    {
    code to be executed;
    }

[ Code ] :
http://pastebin.com/yNii9Gya

Functions (Advanced) :
  • We can also pass parameters to functions during both the declaration and calling time.
  • function functionName($param1,$param2); //during function call.
  • function functionName($param1,$param2) 
  • {
    code to be executed
    }     
[ Code ] : 
http://pastebin.com/hCeJ4Kmk

0 comments:

Post a Comment