On 14/12/11 16:48, Al wrote:
On 12/14/2011 7:59 AM, Rick Dwyer 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?
--Rick
This not a PHP subject and should not be here.
However, styles should be in the style block or better in the styles CSS
file.
Spend some time learning about CSS3 and modern techniques.
With respect to tedd and Al, you've misread the question: the important
PHP-related bit is about whether to embed variables in double-quoted strings or
to concatenate them. These are only two of the options, and each has it's pros
and cons. There has been (some time ago) plenty of discussion on this list about
this sort of thing, including (ISTR) a timed test of the performance
implications of various forms - that only really matters in big loops, of course...
Horses for courses. I use whatever I feel like at the time, and mix various
styles, as long as it's readable!
Cheers
Pete
--
Peter Ford, Developer phone: 01580 893333 fax: 01580 893399
Justcroft International Ltd. www.justcroft.com
Justcroft House, High Street, Staplehurst, Kent TN12 0AH United Kingdom
Registered in England and Wales: 2297906
Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17 1XS
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php