T
T
TechNOIR2018-11-15 15:12:44
PHP
TechNOIR, 2018-11-15 15:12:44

How to do multithreading?

Good afternoon.
Can you please tell me how to use multithreading in pure PHP now?
What is better to use?
I'm sketching a script to work with the API.
It will be essentially small, but since a lot of requests are received, it will linearly work for a long time.
There will be 2 functions:
1. I get a list of user IDs using the API
Then, for each of the received users, the second function will pass
2. Gets user information from another API. For everyone.
Accordingly, if it is linear, then it will interrogate them one by one users.
Is it possible to do something in several threads to speed up the execution of the script? So that 10-20 pieces are polled in parallel
Thanks in advance for the information

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander, 2018-11-15
@Captain

Maybe NodeJS? As far as I understand any multithreading in php is an emulation.
It’s not quite real in the node, but still better ..

N
netrox, 2018-11-15
@netrox

php.net/manual/en/intro.pthreads.php
Warning in red

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question