How to call a php function from the command line

Warning message

JQuery Cycle must be installed in order to run the slideshow. Please go to Status Report for instructions.

Primary tabs

By using the -r parameter we can run a script in-line.

php -r "require 'mylocation.php'; callmyfunc(143);"

where -r Run PHP without using script tags <?..?>

The above line will call callmyfunc() function with numeric argument 143 inside a mylocation.php file.
To run the above command you chould be in the directory where mylocation.php resides.