如何在PHP中发现特定的字符串?

时间:2015-09-30 04:14:39

标签: php string extract

我的代码是

$data = "met with a good salesperson in sunway carnival. her name is Katie Hopkins, manager of Marketing & Sales. Her mobile phone is 0165531477.
And then, met with Katie Holmes, her mobile phone is 0123456777.";

echo preg_match('\h*(\d+)',$data);    

我想从字符串$data中检索特定信息,然后将人员名称分配到数组$name[],并将他们的手机分配到数组$mobile[]。以下是示例,但我不知道如何进行PHP编码以将人名和手机号码输入特定阵列。

$name[0] = 'Kean Teck';
$mobile[0] = '0165531477';

$name[1] = 'Katie Hopkins';
$mobile[1] = '0123456777';

0 个答案:

没有答案