$argv
contains filename and parameters, when the
php script
is called through command line (cmd).
test_args.php
file content:
<?php

echo 'Filename:'.$argv[0].";  ";
echo 'First parameter:'.$argv[1].";  ";
echo 'Second parameter:'.$argv[2].";  ";
If we run the command:
php test_args.php first-param second-param
in
cmd
the script above will output the following:
Filename:test_args.php;  First parameter:first-param;  Second parameter:second-param;
by Valeri Tandilashvili
4 years ago
PHP
1
Pro tip: use ```triple backticks around text``` to write in code fences