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

PHP字符串提取有关问题

WBOY
Release: 2016-06-13 10:23:40
Original
718 people have browsed it

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);
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template