I'm looking for a function that will accept a string representing the scheme portion of a URL (e.g., "http", "https", "ftp", etc.) and return the standard port. It might be used like this:
echo get_port_from_protocol("http"); // 80
As a last resort, I suppose I could write something to parse through /etc/services (assuming I only need to run under UNIX-like operating systems).
But surely there must be something built-in to PHP, no?