title: PHP: undefined offset in explode()
body: <p>I have this:</p>
  
  <pre><code>list($firstname, $lastname) = explode(' ', $queryString);
  </code></pre>
  
  <p>Sometiems $lastname does not gets defined, and it's there i am getting undefined offset error.</p>
  
  <p>Because it can not find anything to put in $lastname, i guess.</p>
  
  <p>After the explode() i have:</p>
  
  <pre><code>if(!$lastname) { $lastname = $firstname; }
  </code></pre>
  
  <p>So my question is how can i define it as the $firstname if $lastname is not defined (if you wrote only 'Adam' and not 'Adam Thompson', the lastname should be defined so it is 'Adam Adam')</p>
  
  <p>It does this for me now, but I am receiving the offset error</p>