JH0019 [状态]=>处理中 [等级]="/> JH0019 [状态]=>处理中 [等级]=">

求教字符串变数组的有关问题

WBOY
Release: 2016-06-13 12:46:06
Original
733 people have browsed it

求教字符串变数组的问题
$s="流 水 号:JH0019 状   态:处理中  等级 :高 时间: 2013-05-28 12:55:29"

如何转为数组结构为
array(
[流水号]=>JH0019
[状态]=>处理中
[等级]=>高
[时间]=>2013-05-28 12:55:29
)
我的思路是:
先把“ ”改|
再把||改|
再把:|改:
再把|:改:
但是时间中的空格和流 水 号中间的空格我就不知道怎么去掉了
最后用
$a=array();
foreach (explode('|',$s) as $s){
list($k,$v)=explode(':',$s);
$a[$k]=$v;}
我已经经改晕了,如何能搞出结果,请大家帮帮忙,谢谢

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!