A bunch of php utility code.