Jump to content

Can someone please explain why this is doing this


aeroswat

Recommended Posts

I'm trying to figure out why this

$res['StudentFName'] = "Carolyn (Beth)"
(strrpos($res['StudentFName'],' ') > 0 ? substr(preg_replace("/[^a-zA-Z\s]/",'',$res['StudentFName']),0,strrpos($res['StudentFName'],' ')+2) . "." : $res['StudentFName'])

 

is returning Carolyn Beth .

but this

$res['StudentFName'] = "Richard (Isaiah)"
(strrpos($res['StudentFName'],' ') > 0 ? substr(preg_replace("/[^a-zA-Z\s]/",'',$res['StudentFName']),0,strrpos($res['StudentFName'],' ')+2) . "." : $res['StudentFName'])

 

is returning Richard I.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.