PHP getopt Operations
Posted
by Rachel
on Stack Overflow
See other posts from Stack Overflow
or by Rachel
Published on 2010-03-11T17:22:55Z
Indexed on
2010/03/11
17:24 UTC
Read the original article
Hit count: 309
This question is regarding getopt function in php. I need to pass two parameter to the php scripts like
php script.php -f filename -t filetype
Now depending upon the file type which can be u, c or s I need to do proper operation.
I am using switch case for the same:
Here is the Code I am using:
// Get filename of input file when executing through command line.
$file = getopt("f:t:");
Switch case should compare the type of the file which I am passing in from the command line (u, c or i) and accordingly match it and do the operation.
switch("I am not sure what should go in there and this is wrong,Please advice")
{
case `Not sure`:
$p->ini();
break;
case `Not sure`:
$p->iniCon();
break;
case `Not sure`:
$p->iniImp();
break;
}
Kindly advise on this !!!
© Stack Overflow or respective owner