Last active
August 29, 2015 14:19
-
-
Save swynter-ladbrokes/f1f0063e23eb10330d2c to your computer and use it in GitHub Desktop.
Cross namespace tick handler doesn't work as I'd hope...
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
<?php | |
include('TickThing.class.php'); | |
echo "Do something\n"; | |
sleep(30); | |
echo "Do something else\n"; |
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
#php main.php | |
Registering tick function as Tick\Thing::tick() | |
* Tick | |
* Tick | |
Do something | |
Do something else |
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
<?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