Jump to content
Larry Ullman's Book Forums

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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...