title: Split a full name using PHP list or explode function
body: <p>I am trying to split a name that I pull from a webpage using simple HTML DOM and the list and explode functions aren't doing the trick. All I want to do is take a name {firstname middle(optional) lastname} and split them. The middle name only shows up on some names and it would be a bonus if I could handle that. </p>
  
  <p>Here's the code: </p>
  
  <pre><code>    &lt;?php
  
      $data = new simple_html_dom();  
      $data-&gt;load_file("http://www.ratemyprofessors.com/ShowRatings.jsp?tid=861228");
      $profName= $data-&gt;find("//*[@id=profName]", 0);
      $profName = strip_tags($profName);
      echo "Full Name: " . $profName = trim($profName);
      list($first, $last) = explode(' ', "$profName ");
      echo "first name: " .  $first;
      echo "last name: " . $last;
  ?&gt;
  </code></pre>
  
  <p>My output reads:</p>
  
  <pre><code>Full Name: Jennifer Aaker
  firstname: Jennifer Aaker
  lastname: 
  </code></pre>