Last active
August 29, 2015 14:11
-
-
Save djfm/62842960753ba183e459 to your computer and use it in GitHub Desktop.
Fibonacci tick
This file contains hidden or 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 | |
/** | |
* This will display the first 10 numbers of the Fibonacci sequence. | |
* Really. | |
*/ | |
declare(ticks=1); | |
$a = 0; | |
$b = 1; | |
register_tick_function(function () use (&$a, &$b){ | |
$c = $a + $b; | |
$a = $b; | |
$b = $c; | |
echo "$c\n"; | |
}); | |
echo "$a\n"; | |
; | |
{} | |
;; | |
;{}{} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment