Im looking to trigger some PHP code each time a member's

Im looking to trigger some PHP code each time a member's subscription level or profile info changes. I took a look at the API and I think its possible, but I have dont know where to start. It there already a function for this?