Skip to content

Instantly share code, notes, and snippets.

View itdoh's full-sized avatar
💭
Creando experiencia digital

itdo itdoh

💭
Creando experiencia digital
View GitHub Profile
<?php
if (function_exists('pcntl_fork')) {
$chunks = ['A', 'B', 'C', 'D'];
foreach ($chunks as $chunk) {
$pid = pcntl_fork();
if ($pid == -1) die("Error al crear proceso hijo.\n");
elseif ($pid) continue; // proceso padre
else {
process($chunk);
exit();
<?php
chdir(__DIR__);
$http = new swoole_http_server('php', 8080);
$http->on('start', function ($server) {
echo "Server has been started!\n";
});
$http->on('request', function ($request, $response) {
swoole_async_readfile('index.html', function($filename, $content) use ($response) {