Math game solver

This is a script designed to run a list of arithmetic functions. It is for a math game where one rolls 3 dice to get a number then roll them again to get 3 numbers that using roots, multiplication, addition, subtraction, division, and exponents. When I input the numbers I get back a blank page. Thanks to all who help.

	$functions = array(
       	<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">
        Target:<input name="Target" type="text" size="20" maxlength="4">
        Number 1:<input name="A" type="text" size="20" maxlength="2">
        Number 2:<input name="B" type="text" size="20" maxlength="2">
        Number 3:<input name="C" type="text" size="20" maxlength="2">
        <input type="submit" name="Send" value="submit">
		$target = $_POST['Target'];
    	$a = $_POST['A'];
		$b = $_POST['B'];
		$c = $_POST['C'];
		$nums = array(brute($a, $b, $c));
		array_push ($num, brute($a, $c, $b));
		array_push ($num, brute($b, $a, $c));
		array_push ($num, brute($b, $c, $a));
		array_push ($num, brute($c, $a, $b));
		array_push ($num, brute($c, $b, $a));
		$results = compare($nums, $target);
		while (list($pos, $result) = each($results))

	function brute($a, $b, $c)
		$array = array();
		while(list($pos, $function) = each($functions))
			$array2 = array
			array_push($array, $array2);
	function compare($arrays, $target)
			while(list($pos, $array)= each($arrays))
				$diffs = array();
				array_push($diffs, $target - $array['result']);
			$mins = min(diffs);
			while (list($pos, $min) = each( $mins))
				$results = array();
				while (list($pos, $diff)= each($diffs))
					if ($min = $diff['result'])
						array_push($results, $diff);
			return ($results);

i fixed it

Sponsor our Newsletter | Privacy Policy | Terms of Service