Simple 2 part question about $_GET AND $_SESSION

What's the difference between $_GET, and $HTTP_GET_VARS? And what does $_SESSION do?
sargentoAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
TherilConnect With a Mentor Commented:
$_GET holds exactly the same data as $HTTP_GET_VARS. Shorter names for these predefined arrays were introduced in PHP 4.1.0, maybe because register_globals were removed from default configuration (register_globals registers cookie, session, get, post etc. to simple global variables).
More information: http://www.php.net/manual/en/reserved.variables.php

$_SESSION ($HTTP_SESSION_VARS) is an array that holds data for the current session. For more information on sessions, see: http://www.php.net/manual/en/ref.session.php
0
 
BatalfCommented:
There are no difference between $_GET and $HTTP_GET_VARS, just 2 ways of refering to the same thing.

$_SESSION is the same as $HTTP_SESSION_VARS and is an assosiative array containing information stored as sessin-variables.

For more info, look at :

http://www.zend.com/manual/ref.session.php
0
 
sargentoAuthor Commented:
If seen this:
print_r($_SESSION);
0
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
sargentoAuthor Commented:
Does that just verify a session?
0
 
sargentoAuthor Commented:
Does that just verify a session?
0
 
BatalfCommented:
NO, it does more than that. It stores all the variables registred in a session.

Example:

<?php
session_start();
if (isset($HTTP_SESSION_VARS['count'])) {
   $HTTP_SESSION_VARS['count']++;
}
else {
   $HTTP_SESSION_VARS['count'] = 0;
}
?>
 
To register the variable:

<?php
if (!session_is_registered('count')) {
    session_register("count");
    $count = 0;
}
else {
    $count++;
}
?>

$HTTP_SESSION_VARS could in this example be replaced by $_SESSION


0
 
sargentoAuthor Commented:
Does that just verify a session?
0
 
sargentoAuthor Commented:
i'll put up 50 for Batalf also! THank you both!
0
All Courses

From novice to tech pro — start learning today.