<?php

function a()
{
	$spodni = $_POST['spodni'];
	$horni = $_POST['horni'];

	$pole = array(1,3,4565,a,6,8,7,9,11,55,x,67,789798,461,3567498741,1423,56767);
	$nove_pole = array();
	
	if (isset($spodni) && isset($horni) && is_numeric($spodni) && is_numeric($horni)) { 
	
		for ($i = 0; $i < count($pole); $i++) {
			if ($pole[$i] >= $spodni && $pole[$i] <= $horni && is_numeric($pole[$i]))  
				$nove_pole[] = $pole[$i]; 				
		}
		
		vypis($nove_pole, $spodni, $horni);			
	}
	
	else {
		header('Content-Type: text/html; charset=UTF-8'); 
		echo "<p>Neplatný vstup.</p>";	
	}
}

function vypis(&$a, $s, $h)
{
	header('Content-Type: text/html; charset=UTF-8');
	
	echo "<p>Do intervalu <{$s},{$h}> patří tato čísla:<br /><br />";
	
	for ($i = 0; $i < (count($a) - 1); $i++)
		echo "{$a[$i]} |"; 

	echo "{$a[count($a) - 1]}</p>";
}

a();

?>
