title: How to split up IP address in PHP
body: <p>I'm trying to split up a string (IP Address) to get each part of the ip address into separate variables.</p>
  
  <p>E.g. 
  $ip = "123.124.125.126"</p>
  
  <p>I would like to get: $ip1 = "123", $ip2 = "124" separately, splitting up the variables using the period.</p>
  
  <p>I'm obtaining the IP address using this code:</p>
  
  <pre><code>&lt;?php
  $ip = getenv('HTTP_CLIENT_IP')?:
  getenv('HTTP_X_FORWARDED_FOR')?:
  getenv('HTTP_X_FORWARDED')?:
  getenv('HTTP_FORWARDED_FOR')?:
  getenv('HTTP_FORWARDED')?:
  getenv('REMOTE_ADDR');
  
  echo $ip;
  ?&gt;
  </code></pre>