Image from Petr Kratochvil — released under Creative Commons.

Learning PHP 8.1 Fibers using Tests

PHP 8.1 introduced the new Fiber class (see the proposed RFC here ), which allows running coroutines inside your script, i.e. two functions executing simultaneously.

Fibers support three methods:
- start()
- suspend()
- resume()