I would like to execute a single php statement like if(function_exists(\"my_func\")) echo \'function exists\'; directly with the command line without having to
if(function_exists(\"my_func\")) echo \'function exists\';
Using PHP from the command line
use " instead of ' on windows when using the cli version with -r
php -r "echo 1"
-- correct
php -r 'echo 1'
-- incorrect
PHP Parse error: syntax error, unexpected ''echo' (T_ENCAPSED_AND_WHITESPACE), expecting end of file in Command line code on line 1