Add a PHP compatible URL encoding method that handles nesting

See: http://stackoverflow.com/a/4014164/877024