Skip to content

Instantly share code, notes, and snippets.

@swynter-ladbrokes
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swynter-ladbrokes/f1f0063e23eb10330d2c to your computer and use it in GitHub Desktop.
Save swynter-ladbrokes/f1f0063e23eb10330d2c to your computer and use it in GitHub Desktop.
Cross namespace tick handler doesn't work as I'd hope...
<?php
include('TickThing.class.php');
echo "Do something\n";
sleep(30);
echo "Do something else\n";
#php main.php
Registering tick function as Tick\Thing::tick()
* Tick
* Tick
Do something
Do something else
<?php namespace Tick;
declare(ticks=1);
class Thing {
static public function init() {
echo "Registering tick function as " . self::CLASS . "::tick()\n";
register_tick_function([self::CLASS, 'tick']);
}
static public function tick() {
echo "* Tick\n";
}
}
Thing::init();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment