Stupid variable scoping in PHP...