Passing Arguments to php from command line?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Muffinthief
    New Member
    • May 2007
    • 51

    #1

    Passing Arguments to php from command line?

    Hi, I have a pretty simple question.
    Is it possible to pass arguments to php if you're running it from command line instead of in a browser? Like:

    # /usr/local/bin/php test.php Hello

    Or could you do something like

    #/usr/local/bin/php test.php?arg=He llo

    (I tried the later and it didn't work but maybe I did something wrong.)
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Muffinthief.

    Check out Using PHP from the Command Line (http://php.net/features.commandline), especially the part about argc and argv.

    Comment

    • Muffinthief
      New Member
      • May 2007
      • 51

      #3
      Thanks! this worked.

      Comment

      Working...