I was going through a manual and found a statement saying "if array element used with '-' as the word separator, the array's element can be accessed by magic quotes".. but didn't provided with any explanations on it. could some one explain the reason behind this?
Asked
Active
Viewed 200 times
-2
-
1What manual? A link would be helpful. – Quentin Jan 31 '12 at 10:15
-
its a company's coding standard manual – OM The Eternity Jan 31 '12 at 10:15
-
BTW Magic quotes are bad m'kay – PeeHaa Jan 31 '12 at 10:15
-
I am aware of it but I want to know how does this work – OM The Eternity Jan 31 '12 at 10:16
-
1PHP doesn't support selective application of magic quotes. Either your coding standards manual is wrong, or it's using terminology incorrectly (it means something other than what it says). That or you're using a customized PHP build internally, or are building on top of a custom framework that does it. – GordonM Jan 31 '12 at 10:20
-
If it is the company manual, then you should have access to the author. Ask them. – Quentin Jan 31 '12 at 10:23
-
Why The hell it is being voted to close.. I am not asking anything irrelevant here.... – OM The Eternity Jan 31 '12 at 10:44
1 Answers
2
It's seemingly this one (since OP won't tell us):
http://www.dagbladet.no/development/phpcodingstandard/#arrayelement
Here "magic quotes" is simply the wrong designation. They mean double quoted string interpolation, specifically:
print "$myarr[foo_bar] world";
versus
print "$myarr[foo-bar] world"; // invalid
And indeed only the first one is correct syntax. Else use curly braces and key quotes:
print "{$myarr['foo-bar']} world";

mario
- 144,265
- 20
- 237
- 291
-
Hey Yes.. This is the manual They Have used... But here also They have menioned about the "magic quotes" in justification – OM The Eternity Jan 31 '12 at 10:41
-
Is the same misdesignation. They are talking about double quoted strings once more. The warnings are notices for undeclared constants. Which is what happens for unquoted array keys in PHP code, not in double quote context. – mario Jan 31 '12 at 11:10