title: Laravel 5.2 Split String First Name Last Name
body: <p>I have a string passed from a form which is full name.</p>
  
  <p>in my database I store first name and last name.. I've split the string using the following:</p>
  
  <pre><code>$name = explode(" ", $request-&gt;name);
  $lastname = array_pop($name);
  $firstname = implode(" ", $name);
  </code></pre>
  
  <p>this works great, however, if the user doesn't enter a surname in the field then the above doesn't work as the lastname becomes the first.</p>
  
  <p>Am I missing something?</p>