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…)

Oct
02
2008
1

PHP Basics: Variables and Constants

PHP is all about Variables! If you are intending to take the Zend PHP 5 Certification then you should be already very aware of Variables therefore I’m going to keep this one small and simple. Constants are even simpler than Variables both PHP Variables and Constants basics are bellow and feature (a lot) in the Certification.
(more…)

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