title: PHP delete everything after comma (including comma)
body: <p>I just can't get my head around the syntax for this. I have an array <code>$foo</code> and I call it within a function: <code>wp_list_pages($foo);</code> (this is a wordpress site).</p>
  
  <p>I found this code online but can't get it to work...
  I've tried both of these ways and it doesn't seem to do anything. Can anyone help?</p>
  
  <pre><code> &lt;?php $mystring = $foo;
  list ($before,$after) = split (',', $mystring);
  echo $before; 
  ?&gt;
  &lt;?php wp_list_pages( $foo ); ?&gt; 
  </code></pre>
  
  <p>or this:    </p>
  
  <pre><code>&lt;?php $has_comma = (stristr($foo, ",")&gt;-1) ? 1 : 0;
  if ($has_comma) {
  list ($before,$after) = split (',', $foo);
  $foo = $before;
  } ?&gt;
  
  &lt;?php wp_list_pages( $foo ); ?&gt; 
  </code></pre>