$PARAM['xmax']) swapvar($PARAM['xmin'], $PARAM['xmax']); if ($PARAM['ymin'] > $PARAM['ymax']) swapvar($PARAM['ymin'], $PARAM['ymax']); $PARAM['xscl'] = abs($PARAM['xscl']); $PARAM['yscl'] = abs($PARAM['yscl']); if ($PARAM['h'] < 25) $PARAM['h'] = 25; if ($PARAM['w'] < 50) $PARAM['w'] = 50; if ($PARAM['xmin'] > 0 || $PARAM['xmax'] < 0) $AXIS['y'] = false; else { $AXIS['y'] = ($PARAM['w'] / (abs($PARAM['xmin']) + $PARAM['xmax'])) * abs($PARAM['xmin']); } if ($PARAM['ymin'] > 0 || $PARAM['ymax'] < 0) $AXIS['x'] = false; else { $AXIS['x'] = ($PARAM['h'] / (abs($PARAM['ymin']) + $PARAM['ymax'])) * abs($PARAM['ymax']); } echo "
";
for ($y = 0; $y < $PARAM['h']; $y++)
{
	for ($x = 0; $x < $PARAM['w']; $x+=(($PARAM['xmax']-$PARAM['xmin'])/$PARAM['w']))
	{
		$xaxis = false;
		$yaxis = false;
		
		$xval = $PARAM['xmax'] - ($x / ($PARAM['w'] / ($PARAM['xmax'] - $PARAM['xmin'])));
		
		$f = (($PARAM['h'] / ($PARAM['ymax'] - $PARAM['ymin'])) * (sin($x)/*$PARAM['f']*/) + $PARAM['ymax']);
		
		if ($y == floor($f))
			echo "*";
		else
		{		
			if ($y == floor($AXIS['x']))
				$xaxis = true;
				
			if ($x == floor($AXIS['y']))
				$yaxis = true;
			
			if ($xaxis && $yaxis)
				echo "+";
			else if ($xaxis)
				echo "-";
			else if ($yaxis)
				echo "|";
			else
				echo " ";
		}
	}
	
	echo "\n";
	$x = 0;
}
echo "
"; function swapvar(&$v1, &$v2) { $temp = $v1; $v1 = $v2; $v2 = $temp; } ?>