Tutorial by Examples: callables

Support for type hinting array parameters (and return values after PHP 7.1) was added in PHP 5.1 with the keyword array. Any arrays of any dimensions and types, as well as empty arrays, are valid values. Support for type hinting callables was added in PHP 5.4. Any value that is_callable() is valid ...
One of the features that we can use with Threadpools is the submit() method which allow us to know when the thread as finish his work. We can do this thanks to the Future object, which return us an object from the Callable that we can use to our own objetives. Here is an example about how to use th...
Another good practice to check when our threads have finished without block the thread waiting to recover the Future object from our Callable is to create our own implemetation for Runnables, using it together with the execute() method. In the next example, I show a custom class which implements Ru...

Page 1 of 1