Sophie

Sophie

distrib > Fedora > 20 > x86_64 > by-pkgid > 092975fc998260ae6bee6b4e36e6698a > files > 13

php-pecl-event-1.10.2-1.fc20.x86_64.rpm

<?php
function write_callback_fibonacci($bev, $c) {
	/* Here's a callback that adds some Fibonacci numbers to the
	   	output buffer of $bev.  It stops once we have added 1k of
	   	data; once this data is drained, we'll add more. */

	$tmp = new EventBuffer();
	while ($tmp->length < 1024) {
		$next = $c[0] + $c[1];
		$c[0] = $c[1];
		$c[1] = $next;

		$tmp->add($next);
	}

	// Now we add the whole contents of tmp to bev
	$bev->writeBuffer($tmp);

	// We don't need tmp any longer
	$tmp->free();
}
?>