How does magic quotes access the array element con

2019-09-20 05:28发布

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?

1条回答
放荡不羁爱自由
2楼-- · 2019-09-20 05:45

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";
查看更多
登录 后发表回答