RE: Preferred Syntax

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Tamara Temple [mailto:tamouse.lists@xxxxxxxxxxxxxxxx]
> Sent: Wednesday, December 14, 2011 1:40 PM
> To: Tedd Sperling
> Cc: Rick Dwyer; PHP-General
> Subject: Re:  Preferred Syntax
> 
> Tedd Sperling <tedd.sperling@xxxxxxxxx> wrote:
> > On Dec 14, 2011, at 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
> >
> > Neither.
> >
> > My advice, take all the style elements out of the anchor tag.
> >
> > echo("<a href='/mypage.php/$page_id'>$page_name</a>");
> >
> > Even the '<br>' can be (perhaps should be) handled by css.
> 
> I think you may have missed the question. The OP was asking whether:
> 
>   "text $var text"
> 
> or
> 
>   "text ".$var." text"
> 
> was preferrable.
> 
> For me, I tend to use the first unless the second makes things clearer
> where they need to be. Syntax hilighing can easily be one of those
> times.
> 
> 
> --

The key thing to remember here is that this is a preference and not a
performance thing.






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux