Read Command Line Arguments

/ Published in: PHP
Save to your folder(s)

If you want to use PHP as a command line program, this code can serve s a reference to read the arguments passed to the program.

Copy this code and paste it in your HTML
  1. <?php
  2. $i=0;
  3. while(count($argv)>$i)
  4. {
  5. echo $argv[$i] . "\n";
  6. $i++;
  7. }
  8. ?>

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.