PHP coding in a post or page

I know there are a lot of Pros out there when it comes to development. I'm starting to dive into the world of coding with PHP. I want to be able to use the existing ability to develop a Post or Page through Wordpress but instead of strictly writing html, I want to be able to use php. More specifically, I want to be able to develop some interactive user content onto Posts and or Pages that can then be restricted through the Membership plugin. So now for a few questions:

1) Is there an easy method to allow one to write php into the existing wordpress platform with regards to developing pages or posts?
2) If the above is not feasible, what's the best alternative? Can the code be generated elsewhere and then implemented onto a page or post via an iframe or something like that?

I think you guys see what I'm trying to get at here. Huge thanks in advance to anyone who can help me with this!

David