PHP - Fonction Threaded :: from ()

Threaded :: from - Création.

Syntaxe

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

Threaded :: from peut créer un objet Threaded anonyme à partir de fermetures.

Threaded :: from peut renvoyer un nouvel objet Threaded anonyme.

Exemple

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