Difference between $foo[bar] and $foo['bar'] in php
arrays, constants, php
Solution
What are the downsides?
Say you have a URL like `http://somesite.com/test.php?item=20` ,
Scenario:1 (Your case)
<?php
echo $_GET[item]; // 20 is printed with a warning..
Scenario:2 (The worst case)
<?php
define('item',20);
echo $_GET[item]; // A warning will be thrown and nothing will be printed.
Should I dig in old projects to replace this or is the performance drop on this really not noticeable?
I recommend you do it.
Problem
I've been using `$foo[bar]` on a lot of project without noticing the missing ' Nowadays, I understand why it works, I assume it is because of a missing constant being replaced by it's name, thus referring to exactly the same array item. But.. Is it very wrong or can it be accepted. What are the downsides? Should I dig in old projects to replace this or is the performance drop on this really not noticeable?