title: validate multidimensional array
body: <p>As the question says i need to validate a multidimensional array, just so you know this is my first time actually using arrays so it might be a pretty bad script but it works and that's all I'm after at the moment. Okay so it's working I have two sessions displaying in this array, when i remove one of the sessions I get this error </p>
  
  <p>"Notice: Undefined index: pop in C:\inetpub\wwwroot\dropdown\test.php on line 30"</p>
  
  <p>I think i know how to fix it but I don't actually know how to implement it. this is me talking through what im after</p>
  
  <pre><code>$myarray (
  
  IF isset session cityname
  
  add the value to my array
  
  ELSE
  
  add a blank value in its place (or just remove it from the array altogether)
  
  IF isset session pop
  
  add the value to my array
  
  ELSE
  
  add a blank value in its place (or just remove it from the array altogether)
  
  echo myarray
  </code></pre>
  
  <p>please note cityname is mandatory whereas pop is not</p>
  
  <p>That's essentially what I'm trying to achieve but i haven't the slightest how to actually go about doing it, here is my current code</p>
  
  <pre><code>if(isset($_SESSION['cityname'])){
          $myarray = array(array($_SESSION['cityname']),
                           array($_SESSION['pop'])
                          );
          foreach($myarray as $key=&gt;$value){
              echo $myarray[$key][0];
          }
  </code></pre>
  
  <p>Any help MUCH appreciated I've lost to much hair to this problem the last couple of weeks!</p>