IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New On quoting array keys
Make sure you look at the [link|http://us2.php.net/manual/en/language.types.array.php|Array do's and don'ts] section. It covers single- double- and non-quoted array keys, as well as the effect of curly braces on variable expansion within double-quoted strings.

The valuable lesson to be learned from this section is that there are several constructs which may be logically equivalent to a parser, but they are not all equally human readable. I count readability as much more important than unexpected validity. That's why I generally don't put arrays into double quotes and let the parser expand them. It's too confusing to read.

echo 'I prefer to do '.$array['this'].'.';
===

Purveyor of Doc Hope's [link|http://DocHope.com|fresh-baked dog biscuits and pet treats].
[link|http://DocHope.com|http://DocHope.com]
Collapse Edited by drewk Aug. 8, 2006, 02:37:31 PM EDT
One quoting array keys
Make sure you look at the [link|http://us2.php.net/manual/en/language.types.array.php|Array do's and don'ts] section. It covers single- double- and non-quoted array keys, as well as the effect of curly braces on variable expansion within double-quoted strings.

The valuable lesson to be learned from this section is that there are several constructs which may be logically equivalent to a parser, but they are not all equally human readable. I count readability as much more important than unexpected validity. That's why I generally don't put arrays into double quotes and let the parser expand them. It's too confusing to read.

echo 'I prefer to do '.$array['this'].'.';
===

Purveyor of Doc Hope's [link|http://DocHope.com|fresh-baked dog biscuits and pet treats].
[link|http://DocHope.com|http://DocHope.com]
New I have to say...
... I personally didn't find your example more "human readible." I had to spend five seconds figuring out what parts of that line were enclosed in quotes, and what parts weren't...
"We are all born originals -- why is it so many of us die copies?"
- Edward Young
New It looks better in vim
What, you don't use vim?
===

Purveyor of Doc Hope's [link|http://DocHope.com|fresh-baked dog biscuits and pet treats].
[link|http://DocHope.com|http://DocHope.com]
New Kate or Quanta...
or, for fast edits, nano.
"We are all born originals -- why is it so many of us die copies?"
- Edward Young
New I can't write code without syntax highlighting
Well, I can, but it's painful. The human brain just isn't wired for identifying matching braces and quotes. That's what computers are for.
===

Purveyor of Doc Hope's [link|http://DocHope.com|fresh-baked dog biscuits and pet treats].
[link|http://DocHope.com|http://DocHope.com]
New both Kate and Quanta have syntax highlighting
"We are all born originals -- why is it so many of us die copies?"
- Edward Young
     Learning PHP Part Deux: When to use (') and when to use (") - (cwbrenn) - (12)
         Keeping in mind that I don't know PHP at all... - (Yendor)
         Double quotes force evaluation of the contents - (drewk) - (2)
             I thought the period was used to... - (cwbrenn) - (1)
                 Err, not really - (JayMehaffey)
         Well they are never required - (JayMehaffey)
         On quoting array keys - (drewk) - (5)
             I have to say... - (cwbrenn) - (4)
                 It looks better in vim - (drewk) - (3)
                     Kate or Quanta... - (cwbrenn) - (2)
                         I can't write code without syntax highlighting - (drewk) - (1)
                             both Kate and Quanta have syntax highlighting -NT - (cwbrenn)
         Sometimes it matters, sometimes it doesn't. - (static)

TURN THE COMPUTER OFF COMPLETELY WHEN YOU ARE WORKING MAGIC.
84 ms