There's only two ways for your code to work as stated:
1) You've got register_globals on, and your session already had a id parameter set
That means you're on an OLD php install, and/or a horribly badly configured one. Register_globals is pretty much the single greatest STUPIDITY in the history of PHP, and it has thankfully been eliminated from "modern" versions of PHP.
2) You created a reference beforehand, e.g.
$_SESSION['id'] = 'foo';
$id =& $_SESSION['id']; // $id now points at the session variable
echo $id; // prints foo
$id = 'bar'; // also changes the session value, because of the referencing.
echo $_SESSION['id']; // prints 'bar', because of the referencing.