Running php from command line

This is one of those “I know this is possible, but don’t know how”.

php -r 'echo "hello world";'

Only useful for simple onelines. You’re very likely to be better of putting code in a php file and run that script like:

php ./helloworld.php