I have some severely deprecated PHP code that I'm sifting through. One of the problems that I have is hundreds of errors like this:
[Mon Dec 09 07:00:33 2013] [error] [client 127.0.0.1] PHP Notice: Use of undefined constant id - assumed 'id' in /home/srv/site.local/content/online.php on line 171, referer: http://site.local/index.php
These result in the practice of a previous coder of calling arrays like this:
$array[some_element]
instead of:
$array['some_element']
So I know how to fix that by going through each file and adding the quotes, over, and over, and over again. My question is how to write script for this. I imagine this might be a sed or awk script, but I'm not sure. I'm going to start working on a sed as soon as I'm done posting this, but any suggestions?