• [^] # Re: Parallel

    Posté par  (site web personnel) . En réponse au message Optimiser script php via multithread. Évalué à 3.

    Tu as un exemple sur le github du code de l'extension.

    <?php
    $runtime = new \parallel\Runtime();
    
    $future = $runtime->run(function(){
        for ($i = 0; $i < 500; $i++)
            echo "*";
    
        return "easy";
    });
    
    for ($i = 0; $i < 500; $i++) {
        echo ".";
    }
    
    printf("\nUsing \\parallel\\Runtime is %s\n", $future->value());