Home >Backend Development >PHP Tutorial > PHP字符串提取有关问题

PHP字符串提取有关问题

WBOY
WBOYOriginal
2016-06-13 13:30:51816browse

PHP字符串提取问题
如:目的地:广州 计划起飞时间:11:00 计划到达时间:14:15 预计起飞时间:11:00


怎么提取后变成: 广州 11:00 14:15 11:00 呢???



谢谢了~~~

------解决方案--------------------

探讨

$s = '目的地:广州 计划起飞时间:11:00 计划到达时间:14:15 预计起飞时间:11:00';
echo preg_replace('/[^\s\d]+(:|:)/', '', $s);
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn