单个数组到多维 [英] single array to multidimensional

查看:76
本文介绍了单个数组到多维的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我有一个字符串,逗号分隔,链接及其各自的URL

。示例:

Google,http://www.google.com,Yahoo!, http://www.yahoo.com,WikiPedia,http://www.wikipedia.org


等等。


i用爆炸('','',$ string)制作一个这样的数组;


现在我想知道我怎么能把这个数组变成类似

这样的东西:


$ array [0] [''name''] = Google

$ array [0] [''url''] = http://www.google .com

$ array [1] [''name''] = Yahoo!

$ array [1] [''url''] = http://www.yahoo.com

$ array [ 2] [''name''] = WikiPedia

$ array [2] [''url''] = http://www.wikipedia.org


我希望/想到这一切都很清楚......


Frizzle。

Hi there,

I have a string, comma separated, with links and their respective URLs
in it. Example:
Google,http://www.google.com,Yahoo!,http://www.yahoo.com,WikiPedia,http://www.wikipedia.org

etc, etc.

i make an array of this with explode( '','', $string );

now what i wonder is how can i turn this array into something like
this:

$array[0][''name''] = Google
$array[0][''url''] = http://www.google.com
$array[1][''name''] = Yahoo!
$array[1][''url''] = http://www.yahoo.com
$array[2][''name''] = WikiPedia
$array[2][''url''] = http://www.wikipedia.org

I hope/think this is all clear ...

Frizzle.

推荐答案

string);


现在我想知道我怎么能将这个数组变成类似

这样的东西:

string );

now what i wonder is how can i turn this array into something like
this:

array [0] [''name''] = Google
array[0][''name''] = Google


array [0] [''url''] = http://www.google.com
array[0][''url''] = http://www.google.com


这篇关于单个数组到多维的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆