Wednesday, October 31st, 2018 | Coding
Last Modified: 2024-11-09
Method for receiving Command Line Interface ( CLI ) variables in a PHP script:
Example: script.php -a 'hello' -b 'yes'
< ?php $a = $argv; $b = array(); if (count($a) != 0) { foreach ($a as $arg){ list($x,$y) = explode('=', $arg); $b["$x"] = $y; } $tweet = $b['tweet']; $authorized = $b['authorized']; } print_r($tweet); ? >
Input Action Output
A collection of snippets and links that have proven useful for development and programming in ColdFusion, JavaScript, jQuery, PHP, Python, Dell, Minecraft, Apple, Mac, Windows, LINUX, Raspberry Pi, Adobe, CSS, and HTML.
©2024 Input Action Output