try to convert php code into hack

it can pass hh_client check but I'm not sure if it works