title: Undefined Offset PHP
body: <p>I am receiving the following error when I try to execute my code.</p>
  
  <pre><code>Notice (8): Undefined offset:  18 [APP/libs/excel_adapters/coverage.php, line 12]
  Notice (8): Undefined offset:  23 [APP/libs/excel_adapters/coverage.php, line 13]
  Notice (8): Undefined offset:  24 [APP/libs/excel_adapters/coverage.php, line 14]
  Notice (8): Undefined offset:  25 [APP/libs/excel_adapters/coverage.php, line 15]
  Notice (8): Undefined offset:  26 [APP/libs/excel_adapters/coverage.php, line 16]
  Notice (8): Undefined offset:  14 [APP/libs/excel_adapters/coverage.php, line 17]
  Notice (8): Undefined offset:  14 [APP/libs/excel_adapters/coverage.php, line 18]
  </code></pre>
  
  <p>With that said, this code is used to upload a spreadsheet to a database. I think my problem is with the $s variable. If someone would please take a look at my code and tell me what my problem is. I think a fresh set of eyes would help me tremendously. </p>
  
  <pre><code>      &lt;?php 
        class CoverageExcelAdapter {
  
      public function extract($s, $args = array()) { 
      App::import('component', 'CakeSession');        
      $userId = CakeSession::read('Auth.User.id');        
      $ret = array();
  
      $ret['Coverage'] = array(
          'name' =&gt; $s[0][12][3], 
          'effective_date' =&gt; $this-&gt;Date-&gt;formatDate($s[0][18][3]),
          'expiration_date' =&gt; $this-&gt;Date-&gt;formatDate($s[0][18][6]),
          'broker_first_name' =&gt; ucwords($s[0][23][3]),
          'broker_middle_initial' =&gt; strtoupper(substr($s[0][24][3], 0, 1)),
          'broker_last_name' =&gt; ucwords($s[0][25][3]),
          'broker_suffix' =&gt; ucwords($s[0][26][3]),
          'producing_id' =&gt; $this-&gt;State-&gt;stateStrToId($s[0][14][3]), 
          'filing_id' =&gt; $this-&gt;State-&gt;stateStrToId($s[0][14][6]),
  </code></pre>
  
  <p>here is my var dump....</p>
  
  <pre><code>array(1) {
      [0]=&gt; array(1) {
          [0]=&gt; array(41) {
              [0]=&gt; string(13) "ProcessorName"
              [1]=&gt; string(10) "BranchCode"
              [2]=&gt; string(9) "FileTaxID"
              [3]=&gt; string(9) "FileState"
              [4]=&gt; string(11) "FileLicense" [5]=&gt; string(5) "First" [6]=&gt; string(6) "Middle" [7]=&gt; string(12) "Company_Last" [8]=&gt; string(11) "InsuredName" [9]=&gt; string(12) "RiskLocation" [10]=&gt; string(14) "UnderwritingCo" [11]=&gt; string(10) "Home State" [12]=&gt; string(8) "PolicyNo" [13]=&gt; string(10) "PolicyType" [14]=&gt; string(10) "MultiState" [15]=&gt; string(14) "LineOfBusiness" [16]=&gt; string(13) "EffectiveDate" [17]=&gt; string(24) "EndorsementEffectiveDate" [18]=&gt; string(7) "EndDate" [19]=&gt; string(7) "Premium" [20]=&gt; string(13) "InsuredAmount" [21]=&gt; string(9) "PolicyFee" [22]=&gt; string(13) "InspectionFee" [23]=&gt; string(6) "CatFee" [24]=&gt; string(7) "SLTaxes" [25]=&gt; string(17) "Fire Marshall Tax" [26]=&gt; string(9) "Surcharge" [27]=&gt; string(21) "Additional Assessment" [28]=&gt; string(11) "StampingFee" [29]=&gt; string(9) "InvoiceNo" [30]=&gt; string(11) "InvoiceDate" [31]=&gt; string(4) "AC1 " [32]=&gt; string(8) "AC1 Date" [33]=&gt; string(12) "AC1_Comments" [34]=&gt; string(3) "AC2" [35]=&gt; string(8) "AC2 Date" [36]=&gt; string(12) "AC2_Comments" [37]=&gt; string(3) "AC3" [38]=&gt; string(8) "AC3 Date" [39]=&gt; string(12) "AC3_Comments" [40]=&gt; string(8) "Comments"
          }
      }
  }
  </code></pre>
  
  <p>here is what I get when I run print_r</p>
  
  <p>print_r</p>
  
  <pre><code>Array (
      [0] =&gt; Array (
          [0] =&gt; Array (
              [0] =&gt; ProcessorName
              [1] =&gt; BranchCode
              [2] =&gt; FileTaxID
              [3] =&gt; FileState
              [4] =&gt; FileLicense [5] =&gt; First [6] =&gt; Middle [7] =&gt; Company_Last [8] =&gt; InsuredName [9] =&gt; RiskLocation [10] =&gt; UnderwritingCo [11] =&gt; Home State [12] =&gt; PolicyNo [13] =&gt; PolicyType [14] =&gt; MultiState [15] =&gt; LineOfBusiness [16] =&gt; EffectiveDate [17] =&gt; EndorsementEffectiveDate [18] =&gt; EndDate [19] =&gt; Premium [20] =&gt; InsuredAmount [21] =&gt; PolicyFee [22] =&gt; InspectionFee [23] =&gt; CatFee [24] =&gt; SLTaxes [25] =&gt; Fire Marshall Tax [26] =&gt; Surcharge [27] =&gt; Additional Assessment [28] =&gt; StampingFee [29] =&gt; InvoiceNo [30] =&gt; InvoiceDate [31] =&gt; AC1 [32] =&gt; AC1 Date [33] =&gt; AC1_Comments [34] =&gt; AC2 [35] =&gt; AC2 Date [36] =&gt; AC2_Comments [37] =&gt; AC3 [38] =&gt; AC3 Date [39] =&gt; AC3_Comments [40] =&gt; Comments
          )
      )
  )
  </code></pre>