On Wed, Dec 14, 2011 at 7:59 AM, Rick Dwyer <rpdwyer@xxxxxxxxxxxxx> wrote: > Hello all. > > Can someone tell me which of the following is preferred and why? > > echo "<a style='text-align:left;size:**14;font-weight:bold' > href='/mypage.php/$page_id'>$**page_name</a><br>"; > > echo "<a style='text-align:left;size:**14;font-weight:bold' > href='/mypage.php/".$page_id."**'>".$page_name."</a><br>"; > > When I come across the above code in line 1, I have been changing it to > what you see in line 2 for no other reason than it delineates out better in > BBEdit. Is this just a preference choice or is one method better than the > other? > I prefer sending arguments to the echo language construct (note, if you send more than one argument, you can't use parentheses.) I perceive this usage to be a clean presentation of the code's intent, easy to use in most IDE's, and it's very fast relative to the other options: echo "<a style='text-align:left;size:**14;font-weight:bold' href='/mypage.php/$page_id'>$**page_name</a><br>"; echo "<a style='text-align:left;size:**14;font-weight:bold' href='/mypage.php/".$page_id."**'>".$page_name."</a><br>"; echo "<a style='text-align:left;size:**14;font-weight:bold' href='/mypage.php/", $page_id, "'>", $**page_name, "</a><br>"; And, for longer lines, I'll often break it up into separate lines by argument like below: echo "<a style='text-align:left;size:**14;font-weight:bold' href='/mypage.php/", $page_id, "'>", $**page_name, "</a><br>"; That all said, I don't change code that uses another convention, as I think it's most beneficial to stay with the established conventions in any codebase (unless you're establishing a new convention and refactoring the entire code base.) This is just my general preference, and I don't believe there is consensus as to the most appropriate. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com