new to php need help on file opening?

West30

New member
lets say I want to execute this on the command line

php myprogram.php stuff1.txt stuff2.txt

I don't know the names of stuff.txt or stuff2.txt ahead of time so I cant have an include in myprogram.php. How would I tell myprogram.php that these are the txt files I need while I type them on the same line as I run myprogram.php?
 
You will need to use get_args to know what are the arguments being passed to the PHP script.

http://us2.php.net/manual/en/function.func-get-args.php

Then all is left to do is to get the file names from the arguments and open / manipulate, etc on the php script.

Have fun
 
Back
Top