At 11:00 PM -0400 8/5/10, Paul M Foster wrote:
On Thu, Aug 05, 2010 at 10:10:26PM -0400, Rick Dwyer wrote:

 > echo "<table border='1'><tr>....

 And elsewhere on the page it follows:

 > echo '<table border="1"><tr>....

Not acceptable and sloppy. Be consistent in your coding style. In
general, HTML attributes should be surrounded by double quotes. I don't
know about javascript. Moreover, it's generally better to simply output
HTML rather than to echo it, like:

<table border="1"><tr>
<?php echo $some_value; ?>


I agree with Paul.

I would only add that you should use what languages best serve your needs. While it may not be obvious, the statement:

<table border="1">

is flawed (IMO).

The "best" way to handle this is to define a class (or id) for the table in a css file and then set the border (i.e., styling) to whatever you want. For example, your HTML would look like:

<table class="my_table">

And your CSS would contain:

   border: 1px solid black;

That way at some future date, you may want to change the border color, size, whatever and it's a trivial thing to do so without having to search through all your code to find ill-placed styling attributes.

As I always say, neither CSS, PHP, or any web language exist in a vacuum. It always best to use whatever language that makes your life (and others) simpler.



PS: Considering that this is Friday. I have a grammar question for the group. I said above:

"neither CSS, PHP, or any web language exist in a vacuum."

Is the word "neither" appropriate in this sentence?

Normally, two items can be compared by "neither" or "nor", but what about more than two items? Is it appropriate to use "neither" or "nor" for more than two items?


PHP General Mailing List (
To unsubscribe, visit:

Reply via email to