Sophie

Sophie

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

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

<?php
/* TODO: Maybe use bufferevent pairs to complete example? */

function read_callback_uppercase($bev, $unused) {
	/* This callback removes the data from $bev's input buffer 128
		bytes at a time, uppercases it, and starts sending it
		back.
	 */

	$tmp = NULL;

	while (1) {
		$tmp = $bev->read(128);
		(!empty($tmp)) or break;
		$bev->write(strtoupper($tmp), $n);
	}
}
?>