How can I run PHP code without writing a module?
Yes, there is, but given your description I wonder if it will help you:


Install module Devel
Go to http://yoursite/devel/php
Enter your code and execute it.