Believe it or not, I get answer: 2 as well.
This means there are indeed some cases where global is not working.
Tried finding the cause:
It seems that if you have a function and put the OP's code (which is a php.net example) inside that function, you will get answer 2.
This is a bit weird and kinda makes sense in a way...
(I'm using PHP 5.2.5 under Apache 2.2.8 in Win XP)
LE:
MY SOLUTION
OK, solved this: when you use global in the 2nd function you obviously get the superglobal variables, those available to everybody (ie. decalared outside any function), but since $a and $b are declared inside the 1st function, they are not part of that scope and are not available to the 2nd function.
My guess for a solution is to declare $a and $b global, outside the 2nd function as well, that is inside the 1st function.
!! Note that the 1st may be not so obvious due to various reasons, like your file (only containing the 2nd function) being included somewhere in the body of a different function in a different file.