PHP - Função Threaded :: from ()

Threaded :: from - Creation.

Sintaxe

public Threaded Threaded::from( Closure $run [, Closure $construct [, array $args ]] )

Threaded :: from pode criar um objeto Threaded anônimo a partir de fechamentos.

Threaded :: from pode retornar um novo objeto Threaded anônimo.

Exemplo

<?php
   $pool = new Pool(5, Worker::class);
   $foo = "tutotialspoint";
   $pool->submit(Collectable::from(function () use ($foo) {
      var_dump($foo);
      $this->setGarbage();
   }));
   $pool->shutdown();