<?php
 
/**
 
* Brute Force Search Class
 
*
 
*
 
*
 
* @package   Brute Force Search Class
 
* @file      example1.php
 
* ****************************************************************************
 
* This example not that twisted!
 
* It only demonstrates the class's functionality!
 
*/
 
 
@set_time_limit(0); //This might be useful. Searching might take too long!
 
 
header("Content-Type: text/plain");
 
require_once("brute_force.class.php");
 
 
function example_callback($arg1, $i)
 
{
 
    echo $i . ": " . $arg1 . "\n";
 
}
 
 
$vals = array("n", "i", "m", "a");
 
$brute_force = new brute_force("example_callback", 4, 4, $vals);
 
if(!$brute_force->errormsg())
 
{
 
    $brute_force->callback_break = false; //This indicates that searching would not be terminated by the callback function, By setting this to true, process will terminate whenever callback function returns true (refer to the documentation)
 
    $brute_force->search();
 
}
 
else
 
{
 
    echo "Brute Force Problem: " . $brute_force->errormsg() . "\n";
 
}
 
?>
 
 |