title: Error: Undefined index: HTTP_X_FORWARDED_FOR
body: <p>I have written this code</p>
  
  <pre><code>    $ips = preg_split("/,/", $_SERVER["HTTP_X_FORWARDED_FOR"]);
      $ip = $ips[0];
      if ($key === $ip &amp;&amp; $val === env('SERVER_ADDR')) {
          $addr = env($ip);
          if ($addr !== null) {
              $val = $addr;
          }
      }
  </code></pre>
  
  <p>But I am getting following error:</p>
  
  <pre><code>&lt;b&gt;Notice&lt;/b&gt;:  Undefined index: HTTP_X_FORWARDED_FOR 
  </code></pre>