title: Using arrays keys without quotes, how to fix it on big project?
body: <p>I started a project using much arrays keys without quotes.</p>
  
  <p>And now I having problems with this method, i didn't knew it was bad when i started my project. I finally wanted to display E_NOTICES errors for reasons but it crash because the log is overloaded with millions notices like <code>PHP Notice: Use of undefined constant message - assumed 'key'</code>.</p>
  
  <p>So to fix it I could add quotes to my keys in my whole project but there are so much ! Is there a way to achieve this with an algorithme or anything to fix my code ? I want replace any undefined constant by a string with quotes, EG:
  <code>$my_array[key]</code> by <code>$my_array['key']</code>.</p>
  
  <p>Thanks.</p>
  
  <p><strong>EDIT:</strong>
  I succeeded to fix all declarations using rejex, like this:</p>
  
  <p><code>\[([^0-9\$\'\"\]])([^\'\"\]]*)\]</code> to <code>\[\'\1\2\'\]</code></p>
  
  <p>But it is not enough, there are much situations where unquoted keys are used without brackets, EG:</p>
  
  <p><code>array_key_exists(unquotedKey,$array)</code></p>
  
  <p><code>$array['key'] = array( unquotedKey =&gt; array(96,56) );</code></p>
  
  <p>etc...</p>
  
  <p>I could fix all situations using regex but I guess I will have much troubles to handle it well, and sometimes keys of my arrays are really constants and it shouldn't be quoted ! If anybody have a better solution it would help me a lot.</p>
  
  <p>The perfect solution would be to be able <strong>to get my code after PHP replaced undefined constants by quoted strings</strong>, is it possible ? It does it each time I compile, it is maybe stored somewhere temporarily.</p>