• PHP Video Tutorials

PHP - Threaded::from() Function



Threaded::from - Creation.

Syntax

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

Threaded::from can create an anonymous Threaded object from closures.

Threaded::from can return a new anonymous Threaded object.

Example

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