simple preg_replace question - remove everything after the comma - inc. the comma
Posted on 2007-03-23
I have a database field "$row_Recordset1['Employee']" that contains lastname, firstname. I want to strip out everything after the , (including the ,) so that it only displays lastname. Im having difficulty getting preg_replace to do what i want. its still displaying the comma
$lastname = preg_replace('/^([^ ]+).*/','\1', $row_Recordset1['Employee']);
any suggestions? Thanks.