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 | |
// 10 buckets and 10 types of color and 100 balls | |
// Each color will have at least one ball. | |
// Each bucket can hold up to ten balls (in result). | |
// Place all balls in buckets so that each bucket at most containst two variants of color. | |
// This function should return list of buckets. | |
// Each bucket is a list of color ids (integers). | |
$scale = 10; |
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 | |
$payload = 'hello world'; | |
$stream = stream_socket_client("tcp://127.0.0.1:5555", $errno, $errstr); | |
if (!$stream) { | |
echo "{$errno}: {$errstr}\n"; | |
die(); | |
} | |
fwrite($stream, $payload); | |
stream_socket_shutdown($stream, STREAM_SHUT_WR); |
OlderNewer