[prev] [index] [next]

Executing PHP Scripts (cont)

PHP scripts are typically executed via a Web server.
PHP scripts can also be executed from the command line.

Command line arguments are available via array $argv.

Example: PHP version of echo

#!/usr/bin/php
<?
  for ($i = 1; $i < count($argv); $i++)
      print "$argv[$i] ";
  print "\n";
?>

In COMP2041, we focus on non-Web PHP scripts.