Determining Shared, PS, Dedi programmatically

Is there a handy environment variable set on PS and Dedi?

If not, what’s the least intensive method for determining if code is running on VPS or Dedicated?

Codebase isn’t a concern, just any seemingly reliable method. BASH, Perl, PHP, anything.

Look at the server name. If it’s of the form “ps12345”, it’s a VPS; if it’s of the form “ds1234”, it’s a dedicated server; otherwise, it’s most likely a shared machine.

Thanks Andrew!