Example #1
0
<?php

class HelloWorld extends Thread
{
    public function __construct($world)
    {
        $this->world = $world;
    }
    public function run()
    {
        print_r(sprintf("Hello %s\n", $this->world));
    }
}
$thread = new HelloWorld("World");
if ($thread->start()) {
    printf("Thread #%lu says: %s\n", $thread->getThreadId(), $thread->join());
}
<?php

require __DIR__ . "/../vendor/autoload.php";
class HelloWorld extends RubbishThorClone
{
    public function commands()
    {
        $this->command('hello NAME', 'say hello to NAME', function ($option_parser) {
            $option_parser->addHead("Says hello to a person.\n");
            $option_parser->addRule('b::', "Congratulates NAME on their bigness");
        });
    }
    public function hello($name)
    {
        echo "Hi, {$name}!\n";
        if (isset($this->options->big)) {
            echo "Aren't you a big fella?\n";
        }
    }
}
$hello = new HelloWorld();
$hello->start($argv);