some php classes and functions