title: Combining array values in PHP when sometimes a value doesn't exist
body: <p>I apologize if this question has a no brainer answer. I am still learning more ins and outs of php.</p>
  
  <p>I have a snippet of code that is taking in a CSV file. This CSV file is uploaded by a user who downloads it from an external source. In the CSV file, the person's first name and last name is not split in separate columns. Therefore, in PHP the following is used:</p>
  
  <pre><code>$member_name = explode( " ", $application_data[5]);
  </code></pre>
  
  <p>The problem is that when this data is then used to render a PDF document to send a letter to the member, it cuts off their last name if their last name is two words.</p>
  
  <p>The information is loaded into the PDF document with the first name and last name field by using:</p>
  
  <pre><code>$member_name[0],
  $member_name[1]                         
  </code></pre>
  
  <p>Can I safely do:</p>
  
  <pre><code>$member_name[0],    
  $member_name[1] + $member_name[2]
  </code></pre>
  
  <p>Even if 99% of the members do not have a space in the last name? Will I get an error that member_name[2] doesn't exist 99% of the time this is done?</p>
  
  <p>I've done some searching on array_merge. Is that a better option? I've been trying to search for how php handles when you add something that doesn't exist and I'm drawing a blank.</p>
  
  <p>I don't want to assume my solution will work and then when the person uploads their CSV file tomorrow, they get an error. </p>
  
  <p>Or maybe I'm looking at this the wrong way and before it attempts to render a pdf document, I should do an if statement that figures out if $member_name[2] exists.</p>
  
  <p>Thank you!</p>