9951 explained code solutions for 126 technologies

php-swooleAsync code example

go(function () { Co::sleep(1); echo 'A'; });
go(function () { echo 'B'; });ctrl + c

launch callback function asynchronously


use this instead of sleep to wait for 1 second in async mode

echo 'A'

this should be outputted after 1 second of execution

echo 'B'

this will be outputted instantly