-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a70dd14
commit 285b278
Showing
2 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
## ➲ CLI With PHP: | ||
PHP offers to execute script through command line. | ||
|
||
### ☴ Overview: | ||
1. [Executing PHP Script in Command Line](#-executing-php-script-in-command-line), | ||
2. [Accepting Command Line Arguments](#-accepting-command-line-arguments) | ||
|
||
### ✦ Executing PHP Script in Command Line: | ||
To execute PHP script in command line, use `php scriptname.php` in command line. | ||
|
||
```bash | ||
php test.php | ||
``` | ||
|
||
### ✦ Accepting Command Line Arguments: | ||
To PHP accepts command line arguments and deliver through the variable `argv`. | ||
|
||
```bash | ||
php test.php arg1 arg2 arg3 | ||
``` | ||
|
||
```php | ||
foreach ($argv as $arg) { | ||
echo $arg . "\n"; | ||
} | ||
``` | ||
|
||
--- | ||
[⇪ To Top](#-cli-with-php) | ||
|
||
[❮ Previous Topic](./xml-and-json.md)   [Next Topic ❯](./debugging-and-profiling.md) | ||
|
||
[⌂ Goto Home Page](../README.md) |