0

I am not familiar with linux commands.But I searched my level best I could not find any solution.

Please help me Is there any command to run/execute a php file functions with arguments.

I know we can execute PHP file using below command

$ php -f test2.php [args]

But I need to execute a function inside a php file.

Or

Is there any php in-build methods to solve this issue?

1 Answer 1

0

In order for php to execute the function, the only way is to write the php code calling this function. A simple php script like this one should do :

<?php
require('your_function_library_file.php');
yourfunction($param1, $param2);

That you can then execute it through the command-line you provided in the question.

Another possibility would be to write the same code directly in the command-line :

php -r "require('your_function_library_file.php');yourfunction($param1, $param2);"
1
  • I am expecting like PHPUnit.likewise in linux command or any other inbuild PHP method except PHPUnit Jan 23, 2014 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.