Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php // Pass any truthy arg via cli to enable blocking select behavior. namespace Concu..
Decoded Output download
<?php
// Pass any truthy arg via cli to enable blocking select behavior.
namespace Concurrent;
$producer = function (int $delay, Channel $channel) {
try {
$timer = new Timer($delay);
$max = random_int(3, 5);
for ($i = 0; $i < $max; $i++) {
$timer->awaitTimeout();
$channel->send($i);
}
} finally {
$channel->close();
}
};
$channel1 = new Channel();
$channel2 = new Channel();
Task::async($producer, 80, $channel1);
Task::async($producer, 110, $channel2);
$block = ((int) ($_SERVER['argv'][1] ?? '0')) ? true : false;
$group = new ChannelGroup([
'A' => $channel1,
'B' => $channel2->getIterator()
]);
do {
$select = $group->select($block ? null : 25);
switch ($select->key ?? null) {
case 'A':
case 'B':
printf("%s >> %s
", $select->key, $select->value);
break;
default:
if (!$block) {
echo "Await next poll...
";
}
}
} while ($group->count());
?>
Did this file decode correctly?
Original Code
<?php
// Pass any truthy arg via cli to enable blocking select behavior.
namespace Concurrent;
$producer = function (int $delay, Channel $channel) {
try {
$timer = new Timer($delay);
$max = random_int(3, 5);
for ($i = 0; $i < $max; $i++) {
$timer->awaitTimeout();
$channel->send($i);
}
} finally {
$channel->close();
}
};
$channel1 = new Channel();
$channel2 = new Channel();
Task::async($producer, 80, $channel1);
Task::async($producer, 110, $channel2);
$block = ((int) ($_SERVER['argv'][1] ?? '0')) ? true : false;
$group = new ChannelGroup([
'A' => $channel1,
'B' => $channel2->getIterator()
]);
do {
$select = $group->select($block ? null : 25);
switch ($select->key ?? null) {
case 'A':
case 'B':
printf("%s >> %s\n", $select->key, $select->value);
break;
default:
if (!$block) {
echo "Await next poll...\n";
}
}
} while ($group->count());
Function Calls
None |
Stats
MD5 | 16bb31687c65cc600b573e674d74bdba |
Eval Count | 0 |
Decode Time | 113 ms |