title: PHP array avoid Undefined offset
body: <p>Hi I have array like this</p>
  
  <pre><code>$subject_names[7]="English";
  $subject_names[11]="Software Engeneering";
  
  //Student can choose multiple subjects and each subject have int_mark and ext_mark
  
  $results['Matt'][7]['int_mark'] =15;
  $results['Matt'][7]['ext_mark'] =55;
  
  $results['Josh'][7]['int_mark'] =12;
  $results['Josh'][7]['ext_mark'] =45;
  $results['Josh'][11]['int_mark'] =14;
  $results['Josh'][11]['ext_mark'] = 52;
  
  // the array is to maintain crosstab format
  </code></pre>
  
  <p>And to print this I did</p>
  
  <pre><code>echo "Student Name\t";
  
  foreach($subject_names as $subject_name)
  {
      echo "$subject_name\t";
  }
  echo "&lt;br&gt;";
  
  foreach ($results as $student_name =&gt; $subjects) 
  {
      echo "$student_name\t";
  
      foreach($subject_names as $subject_id =&gt; $sub_name){
  
          foreach ($subjects[$subject_id] as $mark){ 
               echo "$mark\t";
          }
  
      }
      echo "&lt;br&gt;";
  
  }
  </code></pre>
  
  <p>As Student "Matt" doesn't has subject_id 11 It is giving me a error notice   </p>
  
  <blockquote>
    <p>Notice: Undefined offset: 11</p>
  </blockquote>
  
  <p>How do I Ignore it and print N/A if the Student have not that subject</p>
  
  <p>Thank you for your any help and suggestions</p>