function newImprovedCombo($data, $colRules, $noOfRows, $noOfCols, $startTime, &$counter = 0, $group = array(), $val = null, $i = 0)
{
    if (isset($val)) {
        array_push($group, $val);
    }
    if ($i >= count($data)) {
        $counter++;
        if ($counter >= 1000000) {
            if ($counter % 1000000 == 0) {
                echo $counter . " (" . (microtime_float() - $startTime) . ")" . PHP_EOL;
                exit;
            }
        }
        $pool = new My();
        $pool->start();
        // if(checkSuccess($group, $colRules, $noOfRows, $noOfCols)) {
        // 	echo "<div style=\"float:right\">Solution Found<br />";
        // 	$endTime = microtime_float();
        // 	echo "END:".$endTime."<br />";
        // 	echo "START:".$startTime."<br />";
        // 	echo " - Time taked ".($endTime - $startTime)."</div>";
        // 	exit;
        // }
    } else {
        foreach ($data[$i] as $v) {
            newImprovedCombo($data, $colRules, $noOfRows, $noOfCols, $startTime, $counter, $group, $v, $i + 1);
        }
    }
}
예제 #2
0
<?php

class My extends Thread
{
    public function run()
    {
    }
}
$my = new My();
var_dump($my->start());