PHP URL parser and manipulator