actually that's one of the beautiful things about PHP... it doesn't give a fluck about spacing. nor does it care how many lines your code spans. just don't forget the semicolons at the end of each
logical line of code.... i.e.
if((foo+bar)==baz){echo "true";}else{echo "false";}
is equivalent to
if ( ( foo + bar ) == baz ) { echo "true"; } else { echo "false"; }
is equivalent to
if ( ( foo + bar ) == baz ) {
echo "true";
}
else
{
echo "false";
}
all three of those will print "true" if the sum of
foo and
bar is equivalent to
baz, however the last two examples are more readable than the first two. if you're just doing one command on an
if statement, the second spacing is probably preferrable; however, if you're executing two or more commands, the block-method spacing of the third example will be easier to read at a glance.