For security reasons, WordPress chose to not allow php code in the text of Posts or Pages you create. The two common ways "around" this are:
- Plug-ins written by individuals (not the WordPress development team) specifically to allow php code in Posts or Pages
- Create your own Template file by modifying existing ones in your chosen Theme, typically single.php for Posts and page.php for Pages, either replacing the existing files or having custom ones that you have to select each time you create a post or page.
The plug-in directory is here: http://wordpress.org/extend/plugins/
The best place to start to read about Template files is here: http://codex.wordpress.org/Stepping_Into_Templates
Personally, I choose a third approach: I used Custom Fields to store php, and inserted it in posts, pages and elsewhere using double square bracks around the Custom Field name. But that required me to change templates and write a function (in php) to look for double square brackets in the content of each post or page.