php remove characters afer comma

i have a string...

$string='jpratt, iii';

I want php to remove all characters after the comma...including removing the comma. How do i do this?
cimmerAsked:
Who is Participating?
 
snoyes_jwConnect With a Mentor Commented:
All sorts of ways.  Here are two.

$string = substr($string, 0, strpos($string, ","));

OR

$myArray = explode(",", $string);
$string = $myArray[0];

http://www.php.net/manual/tw/ref.strings.php
0
 
cimmerAuthor Commented:
great
0
All Courses

From novice to tech pro — start learning today.