Jump to content
Larry Ullman's Book Forums

Question On Spaces


Recommended Posts

Is there a reason for placing spaces between some of the two variables when doing a calculation using numbers and not others?  For example in the book it shows:

$taxrate = $tax/100;
$taxrate = $taxrate + 1;
$total = $total * $taxrate;

I've tried it both ways and it works fine.  Just wanted to be sure that there isn't something I missed that will be needed further down the road.  Don't want to develop bad habits now.  Also I've read that spaces add up the loading time and should be avoided.  Is this true?

Link to comment
Share on other sites

Nope. PHP is generally whitespace insensitive. Using spaces there just makes it easier to read.

 

Spaces in HTML can increase the loading time, but that doesn't mean they should be avoided there, either. I'm virtually positive that additional spacing in PHP won't affect performance at all. 

Link to comment
Share on other sites

 Share

×
×
  • Create New...