【发布时间】:2013-03-08 20:56:15
【问题描述】:
我需要从数据库中提取,其中一列中的记录以这种方式组合: 第一个字母(名字 1)。姓 1,第一个字母(名字 2)。姓氏2,....
这是我尝试解决的示例...
$text2= "T. Toth, M. A. Carlo de Miller, T. Stallone";
$keywords = preg_split("/,/", "$text2");
print_r($keywords);
//I got a result in this way:
//Array ( [0] => T. Toth [1] => M. A. Carlo de Miller [2] => T. Stallone )
// I want a result of the form :
//Array ( [0] => T [1] => Toth [2] => M. A. [3] => Carlo de Miller [4] => T and so on....
有人可以知道如何进行?即使它可以在 MYSQL 中
【问题讨论】:
-
这并不容易做到。你将如何区分
T.和M.与 T.Toth 和M.A.Carlo?两者都是首字母,但显然您希望它们区别对待