run php code using terminal code example
Example 1: run a server php terminal
$ cd ~/public_html
$ php -S localhost:8000
Example 2: php run command terminal
php -r "Print \"Hello, World!\";"
$ cd ~/public_html
$ php -S localhost:8000
php -r "Print \"Hello, World!\";"