title: Foreach List of variables from Array with a Variable Function returns Undefined offset: Error
body: <p>Update:
  If I remove<code>$1</code> from line 67 and 68 all Undefiened offset 2 errors are gone</p>
  
  <p>Just one Undefined offset 1 error and that is the var without the x returns as "custom"</p>
  
  <pre><code>&lt;?php list($w, $h, $1) = OX_Tools::explode_format($sformat); // Line 67?&gt;
      &lt;option&lt;?php echo ($adformat == $sformat ? ' selected="selected"' : ''); ?&gt; value="&lt;?php echo $sformat; ?&gt;"&gt; &lt;?php printf($formats['formats'][$sformat], $w, $h, $1); ?&gt;&lt;/option&gt;
  
  // Changed to This
  
  &lt;?php list($w, $h) = OX_Tools::explode_format($sformat); // Line 67?&gt;
      &lt;option&lt;?php echo ($adformat == $sformat ? ' selected="selected"' : ''); ?&gt; value="&lt;?php echo $sformat; ?&gt;"&gt; &lt;?php printf($formats['formats'][$sformat], $w, $h); ?&gt;&lt;/option&gt;
  </code></pre>
  
  <p>Need some help with this one 
  I get the Undefined offset:  1 notice when the value is a word "custom" 
  I get the Undefined offset:  2 when the value is a number separated by an x performed by function <code>OX_Tools::explode_format</code></p>
  
  <p>I have read dozens of posts on this site and others and have tried several of the solutions with no luck in my situation. At this point not sure what else to try. Any ideas would be greatly appreciated. Thank You</p>
  
  <p>results of <code>$sformat</code> after <code>explode_format</code> are</p>
  
  <p>728x90
  468x60</p>
  
  <p>160x600
  120x600</p>
  
  <p>300x250
  125x125</p>
  
  <p>custom</p>
  
  <p>results of <code>$sformats</code> </p>
  
  <pre><code>print_r($sformats);
  Array
  (
      [0] =&gt; 728x90
      [1] =&gt; 468x60
  )
  Array
  (
      [0] =&gt; 728x90
      [1] =&gt; 468x60
  )
  Array
  (
      [0] =&gt; 160x600
      [1] =&gt; 120x600
  )
  Array
  (
      [0] =&gt; 160x600
      [1] =&gt; 120x600
  )
  Array
  (
      [0] =&gt; 300x250
      [1] =&gt; 125x125
  )
  
  Array
  (
      [0] =&gt; 300x250
      [1] =&gt; 125x125
  )
  Array
  (
      [0] =&gt; custom
  )
  </code></pre>
  
  <p>results of <code>$formats</code></p>
  
  <pre><code>print_r($formats);
  Array
  (
      [data] =&gt; Array
          (
              [all] =&gt; Array
                  (
                      [horizontal] =&gt; Array
                          (
                              [0] =&gt; 728x90
                              [1] =&gt; 468x60
                          )
  
                      [vertical] =&gt; Array
                          (
                              [0] =&gt; 160x600
                              [1] =&gt; 120x600
                          )
  
                      [square] =&gt; Array
                          (
                              [0] =&gt; 300x250
                              [1] =&gt; 125x125
                          )
  
                      [custom] =&gt; Array
                          (
                              [0] =&gt; custom
                          )
  
                  )
  
          )
  
      [types] =&gt; Array
          (
              [text] =&gt; Text ads
              [image] =&gt; Image ads
              [ref_text] =&gt; Text referrals
              [ref_image] =&gt; Image referrals
              [textimage] =&gt; Text and image ads
              [link] =&gt; Ad links
              [video] =&gt; Video ads
              [all] =&gt; All ad types
          )
  
      [sections] =&gt; Array
          (
              [horizontal] =&gt; Horizontal
              [vertical] =&gt; Vertical
              [square] =&gt; Square
              [other] =&gt; Other ad formats
              [custom] =&gt; Custom width and height
          )
  
      [formats] =&gt; Array
          (
              [728x90] =&gt; %1$s x %2$s Leaderboard
              [468x60] =&gt; %1$s x %2$s Banner
              [160x600] =&gt; %1$s x %2$s Wide Skyscraper
              [120x600] =&gt; %1$s x %2$s Skyscraper
              [300x250] =&gt; %1$s x %2$s Medium Rectangle
              [125x125] =&gt; %1$s x %2$s Button
              [custom] =&gt; Custom width and height
          )
  
  )
  </code></pre>
  
  <p>The error is on line 67 here is the code</p>
  
  <pre><code>&lt;?php foreach ($sformats as $sformat) : ?&gt;
  &lt;?php list($w, $h, $l) = OX_Tools::explode_format($sformat); //Line 67?&gt; 
              &lt;option&lt;?php echo ($adformat == $sformat ? ' selected="selected"' : ''); ?&gt; value="&lt;?php echo $sformat; ?&gt;"&gt; &lt;?php printf($formats['formats'][$sformat], $w, $h, $l); ?&gt;&lt;/option&gt;
  &lt;?php endforeach; ?&gt;
  </code></pre>
  
  <p>Here is the Function <code>OX_Tools::explode_format</code></p>
  
  <pre><code>&lt;?php
  static function explode_format($format)
  {
      $vars = preg_split("/[x#]+/", $format);
      return $vars;
  }
  ?&gt;
  </code></pre>