opencart中的php全局变量

I am trying to learn using php for practical applications by studying opencart source code and I am stuck at a point

// Register Globals
if (ini_get('register_globals')) {
ini_set('session.use_cookies', 'On');
ini_set('session.use_trans_sid', 'Off');

session_set_cookie_params(0, '/');
session_start();

$globals = array($_REQUEST, $_SESSION, $_SERVER, $_FILES);

foreach ($globals as $global) {
    foreach(array_keys($global) as $key) {
        unset(${$key}); 
    }
} 
}
  1. What I understand is we are trying to unset all the session variables,but if the session was not started earlier why we need to unset it ?
  2. What do unset(${$key}) do exactly ?

  3. Why opencart uses myisam engine ?

1) It's clearing variables, that has keys in $_SESSION, $_REQUEST, $_SERVER and $_FILES variables, if they are empty, than inner loop iteration for that variable will be skipped (there is no need to check if it's set, since it will always be set by default).
E.g. if there is variable $foo and $_SESSION['foo'] is set, than it will unset $foo, not $_SESSION['foo'].

2) It's variable variable. If $key = 'foo', than unset(${$key}) will unset $foo variable.

3) Ask opencart developers why.

Justinas is correct, the section of code you're looking at is basically removing a number of global variables to force the OpenCart developer to use the internal methods available ($this->request->server[] and $this->session for example). The OC developers have done this so that they can ensure the data is consistently handled throughout the store code.

The choice of myisam I believe is for backwards compatibility. When OC 1.x was developed innodb wasn't as widely supported as it currently is. They're working on OC 2 at the moment and I think that will have a choice. There are quite a few blocks of code out there that will change the database format and apply additional indexes for performance.

OpenCart is actually a really nice platform to cut your teeth in MVC principals, however as you mention you're learning PHP, I'd have a hunt round for some generic PHP code too. Depending what you're after doing, MVC could well be overkill.