modified php format function