Skip to content

Instantly share code, notes, and snippets.

@Problematic
Created January 16, 2012 20:36
Show Gist options
  • Save Problematic/1622847 to your computer and use it in GitHub Desktop.
Save Problematic/1622847 to your computer and use it in GitHub Desktop.
hashbang example script
#!/usr/bin/env php
<?php
require 'hashbang.php';
$app = new HashBang(function($firstname, $lastname, $options) {
$output = "Hello, {$firstname}";
if ($lastname) {
$output .= " {$lastname}";
}
$output .= "!\n";
if ($options['yell']) {
$output = strtoupper($output);
}
echo $output;
});
$app->addArg('firstname');
$app->addArg('lastname', false);
$app->addSwitch('-y', '--yell');
$app->go();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment