首页 / PHP / ,这种多维数组怎么输出呢
,这种多维数组怎么输出呢
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了,这种多维数组怎么输出呢,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3530字,纯文字阅读大概需要6分钟。
内容图文
![,这种多维数组怎么输出呢](/upload/InfoBanner/zyjiaocheng/226/1fb215e8e73644b0ad4923f9aeecf6b1.jpg)
Array
(
[0] => Array
(
[url] => http://127.0.0.1/show.php?id=6638
)
[1] => Array
(
[url] => http://127.0.0.1/show.php?id=6637
)
[2] => Array
(
[url] => http://127.0.0.1/show.php?id=6636
)
[3] => Array
(
[url] => http://127.0.0.1/show.php?id=6635
)
[4] => Array
(
[url] => http://127.0.0.1/show.php?id=6634
)
[5] => Array
(
[url] => http://127.0.0.1/show.php?id=6633
)
[6] => Array
(
[url] => http://127.0.0.1/show.php?id=6632
)
[7] => Array
(
[url] => http://127.0.0.1/show.php?id=6631
)
[8] => Array
(
[url] => http://127.0.0.1/show.php?id=6630
)
[9] => Array
(
[url] => http://127.0.0.1/show.php?id=6629
)
[10] => Array
(
[url] => http://127.0.0.1/show.php?id=6628
)
[11] => Array
(
[url] => http://127.0.0.1/show.php?id=6627
)
[12] => Array
(
[url] => http://127.0.0.1/show.php?id=6626
)
[13] => Array
(
[url] => http://127.0.0.1/show.php?id=6625
)
[14] => Array
(
[url] => http://127.0.0.1/show.php?id=6624
)
[15] => Array
(
[url] => http://127.0.0.1/show.php?id=6623
)
[16] => Array
(
[url] => http://127.0.0.1/show.php?id=6622
)
[17] => Array
(
[url] => http://127.0.0.1/show.php?id=6621
)
[18] => Array
(
[url] => http://127.0.0.1/show.php?id=6620
)
)
数组打印出来是这种格式,我想最后输出是这样的格式,怎么做呢?请大神赐教
http://127.0.0.1/show.php?id=6638
http://127.0.0.1/show.php?id=6637
http://127.0.0.1/show.php?id=6636
http://127.0.0.1/show.php?id=6635
http://127.0.0.1/show.php?id=6634
http://127.0.0.1/show.php?id=6633
http://127.0.0.1/show.php?id=6632
http://127.0.0.1/show.php?id=6631
http://127.0.0.1/show.php?id=6630
http://127.0.0.1/show.php?id=6629
http://127.0.0.1/show.php?id=6628
http://127.0.0.1/show.php?id=6627
http://127.0.0.1/show.php?id=6626
http://127.0.0.1/show.php?id=6625
http://127.0.0.1/show.php?id=6624
http://127.0.0.1/show.php?id=6623
http://127.0.0.1/show.php?id=6622
http://127.0.0.1/show.php?id=6621
http://127.0.0.1/show.php?id=6620
------解决思路----------------------
var_dump(array_column($data,'url'));
去看下array_column函数就知道了
------解决思路----------------------
if(! function_exists('array_column')) :
function array_column($input, $column_key, $index_key=null) {
$res = array_map(function($tmp) use ($column_key) { return $tmp[$column_key]; }, $input);
if(! empty($index_key)) $res = array_combine(array_column($input, $index_key), $res);
return $res;
}
endif;
$records = array(
array(
'id' => 2135,
'first_name' => 'John',
'last_name' => 'Doe',
),
array(
'id' => 3245,
'first_name' => 'Sally',
'last_name' => 'Smith',
),
array(
'id' => 5342,
'first_name' => 'Jane',
'last_name' => 'Jones',
),
array(
'id' => 5623,
'first_name' => 'Peter',
'last_name' => 'Doe',
)
);
$first_names = array_column($records, 'id');//'first_name');
print_r($first_names);
$last_names = array_column($records, 'last_name', 'id');
print_r($last_names);
Array
(
[0] => 2135
[1] => 3245
[2] => 5342
[3] => 5623
)
Array
(
[2135] => Doe
[3245] => Smith
[5342] => Jones
[5623] => Doe
)
内容总结
以上是互联网集市为您收集整理的,这种多维数组怎么输出呢全部内容,希望文章能够帮你解决,这种多维数组怎么输出呢所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。