# Worker::stack

(PECL pthreads >= 2.0.0)

Worker::stack — Stacking work

### Beschreibung

public Worker::stack(Threaded `&$work`): int

Appends the new work to the stack of the referenced worker.

### Parameter-Liste

`work`

  A Threaded object to be executed by the worker.

### Rückgabewerte

The new size of the stack.

### Beispiele

Beispiel #1 Stacking a task for execution onto a worker

`<?php
$worker = new Worker();
$work = new class extends Threaded {};
var_dump($worker->stack($work));`

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

    int(1)

`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open