mirror of
https://github.com/codeguy/php-the-right-way.git
synced 2025-08-08 06:56:33 +02:00
Merge pull request #821 from glebocki/patch-1
Changed CLI name variable signature from optional to argument
This commit is contained in:
@@ -27,7 +27,7 @@ Let's write a simple "Hello, $name" CLI program. To try it out, create a file na
|
|||||||
{% highlight php %}
|
{% highlight php %}
|
||||||
<?php
|
<?php
|
||||||
if ($argc !== 2) {
|
if ($argc !== 2) {
|
||||||
echo "Usage: php hello.php [name].\n";
|
echo "Usage: php hello.php <name>.\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
$name = $argv[1];
|
$name = $argv[1];
|
||||||
@@ -45,7 +45,7 @@ To run our script, above, from the command line:
|
|||||||
|
|
||||||
{% highlight console %}
|
{% highlight console %}
|
||||||
> php hello.php
|
> php hello.php
|
||||||
Usage: php hello.php [name]
|
Usage: php hello.php <name>
|
||||||
> php hello.php world
|
> php hello.php world
|
||||||
Hello, world
|
Hello, world
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
Reference in New Issue
Block a user