title: PHP split string into parts
body: <p>I have string with following format:</p>
  
  <pre><code>$date = "2012-07-22 17:48:24";
  </code></pre>
  
  <p>I want to get the year, month and date in the variables and ignore the time. I am trying following:</p>
  
  <pre><code>list($year, $month, $day) = split('[-]', $date);
  </code></pre>
  
  <p>This returns correct values to <code>$year</code> and <code>$month</code>, but the <code>$day</code> gets: <code>"22 17:48:24"</code>, while I want to get only 22.</p>