Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pattern matching

Status
Not open for further replies.

kpdvx

Programmer
Dec 1, 2001
87
US
$name = 'johnoliver'

Ok, I know that $firstname = 'john'.

How can I pull the last name (which is oliver) from $firstname and assign it to $lastname ?
 
preg_match("/^".preg_quote($firstname)."(.*)$/", $name, $m);

$m now contains an array, element number 1 has the surname --BB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top