Last active
March 23, 2018 15:45
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To parse and execute a php script: | |
php file | |
# To check syntax on (i.e. lint) a PHP script: | |
php -l file | |
# To run PHP interactively: | |
php -a | |
# To run PHP code (Notes: Don't use <? ?> tags; escape double quotes with backslash): | |
php -r "code" | |
# To start a PHP built-in web server in the current directory: | |
php -S host:port |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
define('SNIPPETS_START', microtime(true)); | |
if (defined('STDIN')) | |
{ | |
echo 'PHP version .............: ' . phpversion() . PHP_EOL; | |
echo 'Script ..................: ' . basename(__FILE__) . PHP_EOL; | |
echo 'Directory ...............: ' . dirname(__FILE__) . PHP_EOL; | |
echo 'Start time ..............: ' . SNIPPETS_START . PHP_EOL; | |
echo 'Shell user ..............: ' . shell_exec('whoami') . PHP_EOL; | |
} | |
else | |
{ | |
echo 'Console mode only!'; | |
exit(); | |
} | |
require __DIR__ . '/vendor/autoload.php'; | |
// do cool php stuff here ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment