Re: I only want x number of lines of data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



<? phpinfo(); ?>PROMISE<? phpinfo(); ?>TO<? phpinfo(); ?>STOP<? phpinfo(); ?>BREAKING<? phpinfo(); ?>IN<? phpinfo();
?>AND<? phpinfo(); ?>OUT<? phpinfo(); ?>OF<? phpinfo(); ?>PHP<? phpinfo(); ?>TO<? phpinfo(); ?>OUTPUT<? phpinfo();
?>STRINGS<? phpinfo(); ?>TO<? phpinfo(); ?>THE<? phpinfo(); ?>BROWSER<? phpinfo();

<evil_grin>easy to read don't you think?</evil_grin>

Ross wrote:
> At the mometn I have this
> 
> 
> function display_result($module_no) {
> 
> if ($module_no != "") {
> $module_no =unserialize ($module_no);
> foreach ($module_no as $number => $data) {
> 
> $count=$count+1;?>

why $count when you already have $number

> 
> Q.<?=$count; ?>- <span style="font-weight:bold"><?=$data;?></span><BR />
> <?
> }
> }

function display_result($module_no, $max = null)
{
	if (is_string($module_no) && $module_no)
		$module_no = unserialize($module_no); // god knows why your using this
	if (!is_array($module_no)) return;

	if (!$max || !is_int($max)) $max = count($module_no);

	$count = 0;
	foreach ($module_no as $number => $data) {
		if ($count > $max) break;
		echo "Q.", $count++,' - <strong>',$data,'</strong><br />';
	}
}


PS - generally is better when function don't echo stuff... it makes them
more flexible.
> 
> which outputs all the data in the array..typically..
> 
> Q.1- pass
> Q.2- pass
> Q.3- pass
> Q.4- pass
> Q.5- pass
> 
> 
> but what if i only want q1-q3 output? any ideas how I can modify the script 
> to give me x number of outputted answers? 

hunderds - see simple idea number one above to get started.

> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux