explode这个函数怎么把字符串变为多维数组啊

WBOY
Release: 2016-06-13 12:09:03
Original
1004 people have browsed it

explode这个函数如何把字符串变为多维数组啊?
比如我现在有字符串
[email protected][email protected]**http:[email protected][email protected]**http:[email protected][email protected]**http://baidu.com4
这样子的字符串,如何转换成多维数组。
array(
      [0] => array(
                             id=>2
                             title=>我和你
                             url=>http://baidu.com
                              )
      [1] => array(
                             id=>3
                             title=>我和你3
                             url=>http://baidu.com3
                              )
。。。。。。。。。。。。。。

------解决思路----------------------

[email&#160;protected][email&#160;protected][email&#160;protected]:[email&#160;protected][email&#160;protected][email&#160;protected]:[email&#160;protected][email&#160;protected][email&#160;protected]://baidu.com4';<br />foreach(explode('%%%', $str) as $v){<br />    parse_str(str_replace('@', '=', str_replace('**', '&', $v)), $t);<br />    $ar[] = $t;<br />}<br />print_r($ar);
Copy after login

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