Re: Optimization in coding style
- From: Michał Woźniak <mikiwoz_remove_this@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 14 Apr 2005 09:54:06 +0200
One quick glance of an experienced eye allowed to understand the blurred
and almost unreadable Geoff Muldoon's handwriting:
> My preference is to use single quotes unless you are certain that the
> string will surely have an apostrophe, and then decide whether it will
> be better to escape the apostrophe or switch to double quotes.
Agreed.
>> Double quotes are needed, of course in other cases:
>> "Frankly my dear, your name is ${nameOfTheUser}!"
>
> No they're not, and my strongly preferred style is to clearly string
> escape and concatenate variables. For starters in my editor it is far
> superior for syntax highlighting and debugging, even if it is more
> typing:
>
> $string = 'My "nickname" is '.$myNickName.', what\'s yours?';
>
Hmmm... I'd say that it's a definetely less readable than:
$string="My \"nickname\" is $myNickName, what's yours?";
and if you can use single quotes to surround "nickname":
$string="My 'nickname' is $myNickName, what's yours?";
I really like to write readable code. Saves time and hassle.
Besides, don't know about yours, but my editor highlights the variables
surrounded by double-quotes as viariables.
Cheers
Mike
.
- Follow-Ups:
- Re: Optimization in coding style
- From: R. Rajesh Jeba Anbiah
- Re: Optimization in coding style
- References:
- Optimization in coding style
- From: evanescent.lurker@xxxxxxxxx
- Re: Optimization in coding style
- From: Geoff Muldoon
- Optimization in coding style
- Prev by Date: Re: comma seperated list comparison - Another feature???
- Next by Date: Re: php vs asp.net
- Previous by thread: Re: Optimization in coding style
- Next by thread: Re: Optimization in coding style
- Index(es):
Relevant Pages
|