kphp
kphp copied to clipboard
how to parallel code execution with job workers? (CLI)
In Swoole PHP I can run something like
<?php
function test(){
while(true){
sleep(3);
echo "3\n";
}
return null;
}
function test2(){
while(true){
sleep(1);
echo "1\n";
}
return null;
}
Co\run(function (){
go(function () {
test();
});
go(function () {
test2();
});
});
?>
Result will be 1 1 1 3 1 1 1 3 3 3
How to run in parallel mode 2 while(true) functions with job workers in CLI MODE? Could you please provide simplest example of parallelism with out http?