Core PHP constants

Here are some PHP constants that are being used heavily, but get forgotten a lot.

  • $_SERVER[REMOTE_ADDR] will give you the client address connected to this script
  • $_SERVER[‘PHP_SELF’] will give you the current PHP file you are in. useful for debugging
  • $_SERVER[SERVER_PORT] will give you the server port, this is usually 80, BUT, if you want to check for ssl, this is one way to do so.
  • $_FILES – files that were uploded by the user
  • more constants can be found here.