It is possible, but it's a security nightmare. Good luck with it, but do your homework in regards to how you handle unclean data and files, particularly regarding cross-site scripting (CSS or XSS) and file or SQL injections. It's a persistent problem that we've had with Plogger, mainly in regards to comments and register_globals.
For programming references, start here: http://www.techtoolblog.com/archives/195-free-online-programming-books http://www.freeprogrammingresources.com/freephp.html
And never forget the PHP Manual (http://www.php.net), which is phenomenally written.
Also, my suggestion is to write yourself a simple php program called eval.php, which has a textarea on the bottom and runs eval() on the data from the textarea the top.
Use $_GET, so you can pass around the URL or save the code in a bookmark. Then you can write code, submit, see it run, make changes, and run it again. It's great for learning or testing simple proofs-of-concept. Just don't leave it on a public server.