Windows command icon

I have only recently begun working with PHP CLI scripts. Executing PHP scripts from the command line is fairly easy and you require no extra knowledge to create a basic script. As you progress you will need to know some new methods of using PHP.

Below is a PHP script called hello.php which is executed from the command line and takes one optional argument:

if ($argc !== 2) {
    echo "Usage: php hello.php [name].\n";
$name = $argv[1];
echo "Hello, $name\n";

From the command line, issue the command:
php hello.php yourname

By foxbeefly

PHP / MySQL Developer. HTML, CSS and some JavaScript.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.