PHP code example of kdaviesnz / callbackfileiterator

1. Go to this page and download the library: Download kdaviesnz/callbackfileiterator 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/ */

    

kdaviesnz / callbackfileiterator example snippets

 php

        ire_once("src/CallbackFileIterator.php");

		ename) {
				echo $filename . "\n";
				sleep (1);
			};
		};

        $callbackIterator = new CallbackFileIterator();
        $recursive = true;
        $parallel = true;

        // Parallel
        $parallelStartTime = \microtime(true);
        $callbackIterator->run(".", $callback(), $recursive, $parallel);
        $parallelEndTime = \microtime(true);

        // Non parallel
        $nonParallelStartTime = \microtime(true);
        $callbackIterator->run(".", $callback(), $recursive, $parallel);
        $nonParallelEndTime = \microtime(true);

        $parallelTime = $parallelEndTime - $parallelStartTime;
        $nonParallelTime = $nonParallelEndTime - $nonParallelStartTime;

        echo "Parallel took $parallelTime ms\n";
        echo "Non parallel took $nonParallelTime ms\n";