Oct
09
2008
0

Functions: Variable Scope

If you create a variable in the global scope (in main script, outside of a function) then the value of that variable is not available within the function unless passed to it trough constants, arguments or using superglobals.

List of Superglobal’s

$_GET - receaves data sent to php via script url (?page=1)
$_POST - receaves data sent to php via posting form
$_FILES - receaves data from post file uploads
$_COOKIE - receaves data sent to PHP via HTTP cookies
$_REQUEST - receaves data sent via $_COOKIE,$_POST and $_GET
$_SESSION - receaves data avaliable from previosly stored session
$_SERVER - receaves server information
$_ENV - receaves data avaliable from the PHP environment
and the use of global or $GLOBALS['variable']
(more…)

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • LinkedIn
  • Live
  • StumbleUpon
  • Technorati
  • TwitThis
Oct
08
2008
0

Functions: Arguments and Reference Arguments

Zend PHP 5 Certification Blog will now refresh our memory about passing arguments to functions, its a small and simple topic until we get to “Passing Arguments by Reference” where it may get confusing.

Define: Function Arguments

Information may be passed to functions via the argument list, which is a comma-delimited list of expressions.
(more…)

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • LinkedIn
  • Live
  • StumbleUpon
  • Technorati
  • TwitThis
Written by Adam in: 2. Functions | Tags: , , ,
Oct
08
2008
1

Functions: Syntax

PHP Functions and I

I have high knowledge of functions therefore this section of the “Zend PHP 5 Certification Blog” is likely to be short but informative. Writing functions is an essential ability I have found functions useful in many ways to such an extent I have a private ill-documented function library.

Define: Functions

A function is just a name we give to a block of code that can be executed whenever we need it. This might not seem like that big of an idea, but believe me, when you understand and use functions you will be able to save a ton of time and write code that is much more readable!
(more…)

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • LinkedIn
  • Live
  • StumbleUpon
  • Technorati
  • TwitThis
Written by Adam in: 2. Functions | Tags: , ,

WordPress Powered, Theme by TheBuckmaker.com | Add to Technorati Favorites. | RSS and Comments RSS