I want to read the file name from command line rather than using file_get_contents("filename.txt");
command.
I want to read the file from command line and place the output file in the same place(command line) in the form of php myprog.php 1 input.txt output.txt
where input.txt is the input file and output.txt is the output file.
which function can I use in this place?
Need some help.
Use
$argv– it is an array of all the arguments passed to the script when running from the command line. You can then iterate through it and do whatever you need to do based on the count, value of the array keys..