PHP code example of omegaalfa / tasks

1. Go to this page and download the library: Download omegaalfa/tasks library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

omegaalfa / tasks example snippets



use OmegaAlfa\Tasks\Task;

// Define an asynchronous task
Task::async(function() use ($file) {
	echo "Leitura 1 \n";
}, 2);

Task::async(function() use ($file) {
	echo "Leitura 2 \n";
}, 1);

Task::async(function() use ($file) {
	Task::sleep(3);
	echo "Leitura 3 \n";
});
Task::async(function() use ($file) {
	Task::sleep(2);
	echo "Leitura 4 \n";
});

Task::run();