How to determine the subsite number using PHP

I know this is beyond the scope of WPMUDev, but I was hoping someone here would have a quick answer for me. I am building a custom PHP script that I plan to have work over all subsites without having to modify it for each one. I have a set of values that will be different on each subsite, but they will be stored in a MySQL table.

Here’s my thoughts. If the script is running based upon a “Buy” button being clicked on subsite #1, then the script will pull the information associated with subsite #1 and use it in all actions. However, if the “Buy” button is clicked on subsite #7, then the script will pull the information associated with subsite #7 and use it in all actions.

I know that each subsite has a specific number associated with it (or that’s what I believe is correct). Is there a WP hook or something or a PHP function that will get that number for you or will I have to script that function? If I have to script it, any suggestions on the simplest way? Sometimes I find a way to accomplish something, but it will end up being overly complex.

Thanks for any suggestions. If you need more info to give an opinion/suggestion, just ask and I’ll provide.

JDD