Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 1.1 KB

File metadata and controls

30 lines (21 loc) · 1.1 KB

Command line application template for PHP

Implement CLI application by editing Main.php.
You may add new files to keep your code clean, if it is allowed in your challenge.

How to get input parameters

You can get commandline arguments as $argv and also can get count of the $argv by $args in Main.php file where run method is defined.

<?php

function run ($argc, $argv)
{
  // code to run
}

$argc and $argv in this method came from $argc and $argv without script name information, passed in index.php. Although it has same variable name, please be careful that $argc and $argv in run method does not connected to the arguments linked in above.

How to output result

You can use print functions in order to print your result into sdtout.

printf("%s\n", args);

Install External Libraries

If you want to use external libraries, do the following: