Page 2 of 2
how about this one?
Posted: Sat Nov 02, 2002 8:57 am
by Kyori
for($ey=$y-4,$a=0;$ey!=$y+5;$ey++)
for($ex=$x-4;$ex!=$x+5;$ex++,$a++)
if($row[0] == $ex && $row[1] == $ey)
$critters[a]++;
OR
for($ey=$y-4,$a=0;$ey!=$y+5;$ey++)
{
for($ex=$x-4;$ex!=$x+5;$ex++,$a++)
{
if($row[0] == $ex && $row[1] == $ey)
{
$critters[a]++;
Posted: Sat Nov 02, 2002 9:10 am
by volka
not using code/php-block here your whitespaces are skipped by html

Posted: Mon Nov 04, 2002 9:29 am
by phice
Usually if you came from C++, you'd do your if, while, for's like:
Code: Select all
<?php
if ($var == 1)
{
echo $var;
}
?>
But, if you came directly to PHP, like me, you'd use:
Code: Select all
<?php
if ($var == 1) {
echo $var;
}
?>
Posted: Mon Nov 04, 2002 10:50 am
by DeGauss
Depending on how far i think i'm going to nest if...else stuff...
if ($blah) {
<tab>print "spoon\n";
}
if i've got something that spans multiple lines, i do the following:
if (!$_POST["polNumber"]) { $_SESSION["polNumber"]=NULL; unset($_SESSION["polNumber"]); $_SESSION["errPN"]=1; } else { $_SESSION["errPN"]=NULL; unset($_SESSION["errPN"]); $_SESSION["polNumber"]=$_POST["polNumber"]; }
Posted: Sat Nov 09, 2002 2:30 pm
by Takuma
Mmmm
I've converted nearly all my spaces into tabs. I just thought the file size migh be smaller if I do this

Posted: Mon Nov 11, 2002 9:33 am
by Heavy
I usually try to put the first character indented to be vertically below the first non symbol character after the reserved word. And I keep doing so through nested braces.
Also, I like to indent function content so that only the word "function" is to the left:
Code: Select all
function MySub($blablabla){
$blabla = "$blablabla no way";
if (strlen($blabla) > 7){
echo "DUMB";
}elseif (is_float($blablabla)){
echo $blablabla / 4;
}else{
echo "$blablabla divided by 4";
}
$strSQL = "select passwords from databases all over the world!";
$result = mysql_query($strSQL);
while($row = mysql_fetch_array($result)){
echo "Password: {$rowї'pass']}<br>";
}
}
... at least using syntax hiliting it is easy to read... I think...
I hate tabs...
But I am still considering using them because I like to indent much, and tabs require less bytes.
Takuma wrote:I've converted nearly all my spaces into tabs. I just thought the file size migh be smaller if I do this