socialmatrix Posted October 26, 2008 Share Posted October 26, 2008 I am trying to write a program, that takes as input a single argument on the command line. How do I do this? Thank You, Atit Link to comment https://forums.phpfreaks.com/topic/130193-command-line-arguments/ Share on other sites More sharing options...
corbin Posted October 26, 2008 Share Posted October 26, 2008 $_SERVER['argv'][1] Link to comment https://forums.phpfreaks.com/topic/130193-command-line-arguments/#findComment-675185 Share on other sites More sharing options...
Jeremysr Posted October 26, 2008 Share Posted October 26, 2008 When executing php from the command line it should set the $argc (number of arguments) and $argv (array of the actual arguments) variables. $first_argument = $argv[1]; Link to comment https://forums.phpfreaks.com/topic/130193-command-line-arguments/#findComment-675188 Share on other sites More sharing options...
corbin Posted October 26, 2008 Share Posted October 26, 2008 When executing php from the command line it should set the $argc (number of arguments) and $argv (array of the actual arguments) variables. $first_argument = $argv[1]; Oooo weird didn't know it made $argc/$argv. I've always just used $_SERVER[blah] Link to comment https://forums.phpfreaks.com/topic/130193-command-line-arguments/#findComment-675197 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.