update page now

The Fiber class

(PHP 8 >= 8.1.0)

Introduction

Fibers represent full-stack, interruptible functions. Fibers may be suspended from anywhere in the call-stack, pausing execution within the fiber until the fiber is resumed at a later time.

Class synopsis

final class Fiber {
/* Methods */
public function __construct(callable $callback)
public function start(mixed ...$args): mixed
public function resume(mixed $value = null): mixed
public function throw(Throwable $exception): mixed
public function getReturn(): mixed
public function isStarted(): bool
public function isSuspended(): bool
public function isRunning(): bool
public function isTerminated(): bool
public static function suspend(mixed $value = null): mixed
public static function getCurrent(): ?Fiber
}

See Also

Fibers overview

Table of Contents

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top