using $a a second time does redefine it's value, your original method did not, which is why you didn't get the result you expected.
You can check the function reference at php.net for which functions modify the content of its arguments, it's the minority.
essentially, most (normal) functions take argument(s) and return a result based off those argument(s). This means for functions like the array functions, that manipulate arrays, if you want to change your array to the result, you assign it. some other functions use a 'pass by reference' method, like array_pop, that takes an array as an argument, modifies it, and returns something else - ie it takes the array, removes the last element from it, and returns it.
(to check for pass my reference for functions that modify their arguments - the & is the key for this. ie:
function reference ( &$arg )
{
$old_value = $arg;
$arg = 'new value';
return $old_value;
}
// a rather pointless function - will cause this:
$a = 'old value';
$b = reference( $a );
print $a;
print $b;
/* would have the output:
new value
old value
*/
// where as:
function noReference ( $arg )
{
$old_value = $arg;
$arg = 'new value';
return $old_value;
}
// an even more pointless function - will cause this:
$a = 'old value';
$b = noReference( $a );
print $a;
print $b;
/* would have the output:
old value
old value
*/
I hope this helps explain