You are here: Help understanding a script « PHP Programming Language « IT news, forums, messages
Help understanding a script

Posted by <newbie on 03/20/06 01:52

I was wondering if anyone can help explain this code for me

[CODE
]<table width="<?= $TABLE_WIDTH ?>" border="0" cellspacing="0" cellpadding="0">
<?php
for ($x=1; $x<=pow(2, $COLUMNS); $x++) {
// open the row
printf('<tr>');

// draw each of the columns in this row...
for ($y=1; $y<=$COLUMNS; $y++) {

// begin with a default style
$style = "line";
$value = "";

// Determine the content for the data cells (if there is any) and
// add the underline style always
if (($x % pow(2, $y)) == pow(2, $y-1)) {
[/CODE]


From what I try to understand this code

[CODE]
if (($x % pow(2, $y)) == pow(2, $y-1)) {
[/CODE]

would be a smaller number divided by a larger number and would give the remainder. I have tried a smaller number divided by a larger number in a simple script, but the remainder always seems to equal the smaller number.

[CODE]
<?php
$a=6;
$b=11;
$c=$a%$b;

echo "$a % $b = $c";

?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация