php3-list | 199903
Date: 03/18/99
- Next message: Rasmus Lerdorf: "Re: [PHP3] Semi-OT: The Linux plunge"
- Previous message: Milen A. Radev: "[PHP3] exec() problem (newbie)"
- In reply to: Calum Lasham: "RE: [PHP3] displaying search results"
- Next in thread: James Coates: "Re: [PHP3] displaying search results"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>>From: Timothy Sarver [mailto:veritas <email protected>]
>>Sent: Thursday, March 18, 1999 2:03 PM
>>To: php3 <email protected>
>>Subject: [PHP3] displaying search results
>>
>>
>>Does anyone have a script that will display the results of a search in
>>alternating colors; one row white the next light gray, ect,ect.
>
>This will do the job, for any number of colors, but it does use the
>arbitrary precision math functions, which you may or may not have compiled
>in. I guess it may be a bit cpu heavy for big loops, but its
>quite elegant.
>There are others ways to achieve the same result.
>
>$colors=array("#3399FF","#3366CC","#6666CC","#3399CC","#99CCCC");
>$numcolors=count($colors);
>
>for($i=0;$i<10;$i++){
> echo $colors[ bcmod($i,$numcolors) ],'<br>';
>}
Its a little more elegant without the bcmod ;)
$colors=array("#3399FF","#3366CC","#6666CC","#3399CC","#99CCCC");
$numcolors=count($colors);
for($i=0;$i<10;$i++){
echo $colors[ $i % $numcolors ],'<br>';
}
Regards.
>>
>>Thanks
>>
>>
>>--
>>PHP 3 Mailing List http://www.php.net/
>>To unsubscribe send an empty message to php3-unsubscribe <email protected>
>>To subscribe to the digest list: php3-digest-subscribe <email protected>
>>For help: php3-help <email protected> Archive:
>>http://www.php.net/mailsearch.php3
>>List administrator: zeev-list-admin <email protected>
>>
>>
>>
>
>
>--
>PHP 3 Mailing List http://www.php.net/
>To unsubscribe send an empty message to php3-unsubscribe <email protected>
>To subscribe to the digest list: php3-digest-subscribe <email protected>
>For help: php3-help <email protected> Archive:
http://www.php.net/mailsearch.php3
List administrator: zeev-list-admin <email protected>
-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3 List administrator: zeev-list-admin <email protected>
- Next message: Rasmus Lerdorf: "Re: [PHP3] Semi-OT: The Linux plunge"
- Previous message: Milen A. Radev: "[PHP3] exec() problem (newbie)"
- In reply to: Calum Lasham: "RE: [PHP3] displaying search results"
- Next in thread: James Coates: "Re: [PHP3] displaying search results"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

