title: "Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP
body: <p>I'm running a PHP script and continue to receive errors like:</p>
  <blockquote>
  <p>Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php on line 10</p>
  <p>Notice: Undefined index: my_index C:\wamp\www\mypath\index.php on line 11</p>
  <p>Warning: Undefined array key &quot;my_index&quot; in C:\wamp\www\mypath\index.php on line 11</p>
  </blockquote>
  <p>Line 10 and 11 looks like this:</p>
  <pre><code>echo &quot;My variable value is: &quot; . $my_variable_name;
  echo &quot;My index value is: &quot; . $my_array[&quot;my_index&quot;];
  </code></pre>
  <p>What is the meaning of these error messages?</p>
  <p>Why do they appear all of a sudden? I used to use this script for years and I've never had any problem.</p>
  <p>How do I fix them?</p>
  <hr/>
  <blockquote>
  <p><sub><strong>This is a General Reference question</strong> for people to link to as duplicate, instead of having to explain the issue over and over again. I feel this is necessary because most real-world answers on this issue are very specific. </sub></p>
  <p><sub>Related Meta discussion:</sub></p>
  <ul>
  <li><sub><a href="https://meta.stackexchange.com/questions/62258/what-can-be-done-about-repetitive-questions">What can be done about repetitive questions?</a></sub></li>
  <li><sub><a href="https://meta.stackexchange.com/questions/63762/do-reference-questions-make-sense">Do “reference questions” make sense?</a></sub></li>
  </ul>
  </blockquote>