https://github.com/jeffotoni/phpconcurrency
PHP is single threds, unfortunately it is not designed to work in competition or parallelism.
https://github.com/jeffotoni/phpconcurrency
concurrent-programming php php-7 php7
Last synced: 6 months ago
JSON representation
PHP is single threds, unfortunately it is not designed to work in competition or parallelism.
- Host: GitHub
- URL: https://github.com/jeffotoni/phpconcurrency
- Owner: jeffotoni
- Created: 2017-07-11T14:27:23.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-11T18:32:10.000Z (over 8 years ago)
- Last Synced: 2025-06-08T16:03:19.310Z (7 months ago)
- Topics: concurrent-programming, php, php-7, php7
- Language: PHP
- Size: 3.07 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PHP Concurrency
PHP is single threds, unfortunately it is not designed to work in competition or parallelism.
Competition is not parallelism. Parallelism is when two or more threads are running the code simultaneously against different processors.
What I will demonstrate here is a simple example in PHP running in competition.
One way to do this is to use [class.threds](http://php.net/manual/pt_BR/class.thread.php.)
I will use "GOTO" to compete with PHP, it is not an elegant and not the most indicated, but here we have the didactic objective and nothing else.
[Goto](http://php.net/manual/en/control-structures.goto.php) can be used to jump to another section of the program.
One can not jump into a loop or switch structure.
One can jump out of them, and one common use is to use goto in place of a multi-level break.
But in our example we will not do FOR, WHILE or better no control structure, we WILL USE OWN goto to generate OUR FOR.
We will make a FOR without using "FOR" simply with goto, and that is where our example looks very interesting when we are going to compete.
Our example will fill 2 vectors but in concurrency.
VetA and VetB with 10 random positions.
# Example of operation
