Just to complement Marc's answer from the point of view of someone who actually has some knowledge of PHP:
The original answeroriginal answer (which was later edited) was correctly describing scoping in PHP, but proposed to solve the problem by importing global variables into the function. This is considered very bad practice (at least in PHP).
As such the downvoters probably decided that the answer is "not useful" (the definition of a downvote): Even though it does answer the question in some way, it proposes a very bad solution to the problem, which eventually would cause more harm than good (thus being "not useful").
I don't see any problem with downvoting such an answer and I don't see an issue with showing the answer to other people, so they can decide whether they want to downvote it too (it's their choice!)
By the way, the answer is now edited and warns about the use of globals. So now there is no reason to downvote anymore.