Can I create a php page something like, on which I can do live experiments.Like on which I can write the PHP code, and then execute the same.
For example http://www.freephptest.com/
For testing purposes.
You use iframes and target the neighboring frame.
Here is another example, pick it to bits and see how they do it.
BeachPHP maybe worth a look too.