Profile Picture
IT Made Easy
The site provides some rough IT Notes that make your life easier. The site currently has notes on HTML, CSS, Regex, OOPS, JS, JQuery, PHP, Java, ASP.NET, C#, Database, Linux, URL Rewrite, SEO, Project Management and Hosting. Please do share this site if you like.

Functions

Next
Next
  • There is no function overloading in PHP rather it may be simulated using __Call__ magic method. This is because PHP functions can take variable-length argument lists. The functions func_num_args( ), func_get_arg( ) and func_get_args( ) help us in this case
  • PHP also provides default parameters
  • $GLOBALS — References all variables available in global scope. Use global keyword to access a global variable in a function by importing specific global variable into the local variable table
  • Variable variables $$var
  • Super Globals : $GLOBALS, $_GET, $_POST, $_SESSION, $_COOKIE, $_FILE, $_REQUEST $_SERVER, $_ENV
  • While passing arguments by reference &. Similarly returning also using ampersand operator
  • Anonymous functions or closures are given below. Anonymous functions yield objects o closure class

$area=function ($side) {

return $area * $area;

}

echo $area (5);

  • define(“const”, value, t/f)   where true means case insensitive
  • To check a constant we use defined(“const”)
  • To return retrieve value of a constant from a variable holder or a function   we use constant($var) where $var = const etc

IT Notes

by VinodSebastian



IT Downloads


Catalogue